如何在自动缩放环境中使用 RabbitMQ 消费者设置 spring.cloud.stream.instanceCount?

How to set spring.cloud.stream.instanceCount with RabbitMQ consumers on autoscale environment?

我是 运行 RabbitMq 消费者,使用 spring 云基础设施。文档说明如下:

spring.cloud.stream.instanceCount
The number of deployed instances of an application. Must be set for partitioning on the producer side. Must be set on the consumer side when using RabbitMQ and with Kafka if autoRebalanceEnabled=false.
Default: 1.
spring.cloud.stream.instanceIndex
The instance index of the application: A number from 0 to instanceCount - 1. Used for partitioning with RabbitMQ and with Kafka if autoRebalanceEnabled=false. Automatically set in Cloud Foundry to match the application’s instance index.

我的消费者 运行 在自动缩放环境中 - 当队列超过阈值时,会引发更多消费者实例,当它再次下降时,一些消费者会关闭。

那么我应该如何定义这些参数?
它们真的是强制性的吗?

这些属性仅在使用分区队列时适用。

rabbitmq binder 在使用分区时不支持自动缩放。

只要不使用分区,都可以忽略。