如果现有消费者死亡,消息分组如何影响消息的分发?

How does message-grouping impact distribution of the messages if an existing consumer dies?

下图描述了我使用消息组和基于 Spring 的 JMS 消费者的基本用例。

请注意,这里的并发是指如下所示的配置集:

defaultJmsListenerContainerFactory.setConcurrency("3-10");

如果G1 listener挂了,群里剩余的消息会自动重新分配给另一个listener吗?

是的,如果接收分组消息的消费者断开连接(出于任何原因),那么将选择另一个消费者来接收来自该组的消息。这在 the documentation:

中有详细说明

Messages in a message group are always consumed by the same consumer, even if there are many consumers on a queue. They pin all messages with the same group id to the same consumer. If that consumer closes another consumer is chosen and will receive all messages with the same group id. (emphasis mine)