Spring Cloud Stream 3.2.3文档无concurrency属性相关疑问
文档内容是正确的
在Spring Cloud Stream 3.2.x(对应Spring Cloud 2021.0.3)的Rabbit Binder中,concurrency属性已被移除,官方文档不再提及是符合版本变更逻辑的,取而代之的是maxConcurrency属性,同时新增了exclusive属性用于控制独占消费者行为。关于属性类的一致性
org.springframework.cloud.stream.binder.ConsumerProperties是通用消费者属性类,而concurrency是Rabbit Binder特有的属性,原本定义在org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties中。在3.2.x版本里,这个RabbitConsumerProperties类已经移除了concurrency字段,替换为maxConcurrency,完全和官方文档保持一致。补充说明
你之前使用的Spring Boot 2.4对应的Spring Cloud版本(如2020.0.x)中,Rabbit Binder还保留着concurrency属性,升级到3.2.x后该属性被废弃移除,所以你的旧配置里没有exclusive和maxConcurrency。迁移时需要将原concurrency配置替换为maxConcurrency;若需要独占消费者模式,可设置exclusive: true(此时maxConcurrency会被强制设为1)。
内容的提问来源于stack exchange,提问作者Marcos

