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;
}
I am thinking the use case scenario of durable consumer is
I have a process which publishes message and the message is pickedup by listeners. I was thinking if someone stopped the process and I restarted it again, I wouldnt lose messages and their processing because f durable consumers.
Is that right?
I will not lose messages because the messages are in KahaDB and after the process is restarted it will resend the messages which havent been completely processed to listeners because they are durable. Is this right explanation ?