RabbitMQ + Spring 云流:组的使用

RabbitMQ + Spring cloud stream: usage of groups

使用 RabbitMQ + Spring 云流时,您可以在 application.properties 文件中定义以下属性:

spring.cloud.stream.bindings.input1.destination=someDest
spring.cloud.stream.bindings.input1.group=someGroup

我猜"destination"是指RabbitMQ队列,但是这里的"group"是什么意思?

谢谢!

destination表示话题交流group 表示绑定到该交换的 queue。因此,如果多个应用程序使用不同的组,它们可能会订阅相同的目的地并获得相同的消息。如果组相同,则只有一个消费者实例会收到一条消息。

有关详细信息,请参阅文档:http://cloud.spring.io/spring-cloud-static/spring-cloud-stream-binder-rabbit/2.1.0.RC4/single/spring-cloud-stream-binder-rabbit.html#_rabbitmq_binder_overview

实际上,目的地是交易所名称;队列 someDest.someGroup 将绑定到交换 someDest.

提供群组后,应用的多个实例将竞争消息。

如果没有组,队列将是一个匿名自动删除队列。