英文:
Java - How to have multiple subscribe from a single publisher in SpringCloud and RabbitMQ
问题
如何为单个发布者拥有多个订阅者?
例如,
已经有两条不同的消息被发布到队列中。Msg1 和 Msg2。
订阅者1 需要消费 msg1,
订阅者2 需要消费 msg2。
在 Java 中,我们如何使用 Spring Cloud Stream 和 RabbitMQ 来实现这一点?
英文:
How to have multiple subscriber for a single publisher?
For eg.
Two different message has been published to queue. Msg1 & Msg2.
Subscriber1 needs to consume msg1 and
Subscriber2 needs to consume msg2.
How can we achieve this using spring cloud stream and rabbitMQ in java?
答案1
得分: 0
你可以使用事件路由功能来实现。我们支持两种模型;路由到(特定消息处理程序/订阅者),这也是您正在寻找的,以及_路由自_。提供的链接中有示例,请仔细阅读并随时提出更具体的问题。
英文:
You can do it using Event Routing feature.
We support two models; Routing TO (specific message handler/subscriber) which is what you are looking for as well as Routing FROM. There are examples in the provided link so please go through it and feel free to follow up with more concrete question.
专注分享java语言的经验与见解,让所有开发者获益!
评论