So I am creating concurrent consumers to a topic i.e. multiple listeners. I am configuring them to be durable.
@Bean
public DefaultMessageListenerContainer listenerContainers() {
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory(connectionFactory());
container.setDestinationName(COMMENT_QUEUE);
container.setPubSubDomain(true);
container.setSessionTransacted(true);
container.setConcurrentConsumers(2);
container.setSubscriptionDurable(true);
container.setMessageListener(datafileSubscriber);
container.start();
return container;
}
What I want to know is,
Lets suppose a event came and it is published to all 5 subscribers. One of them processes it, so it doesnt immediately acknowledge until the process is done but remaining 4 immediately acknowledge because they are idle.
Lets suppose a second event came, Now
Is it sent to 4 subscribers and keeps the message in queue for 5th subscriber and sends it to 5th subscriber only after it gives a acknowledgement?
OR
It doesnt send to any of the message subscribers but waits in the queue until the 5th subscriber also acknowledges and then sends out to all the subscribers at a time?
I am using setsessiontransacted true. What happens now 1 or 2 ? Also I am assuming the broker maintains an internal queue for each concurrent subscriber to understand the flow of messages to that durable subscriber.
Can someone explain how the flow works for the configuration of concurrentconsumer, durable subscription and setsessiontransacted=true?