I'm new to JMS pub/sub using Spring boot and Apache Active MQ . Could you please help to understand the below scenarios?
Scenario 1:
Step1: I have a publisher which publishes a message (Say MessageA) to a Topic (Say TopicA) and during the time it was published there were no subscribers/ consumers, hence the message goes to Messages Enqueued in Apache Active MQ.
Step2: I have a new subscriber now to the TopicA, how to claim the earlier MessageA which was already Messages Enqueued in Apache Active MQ?
My Conclusion: Earlier nobody subscribed and hence you may not get the MessageA. (Please correct if I’m wrong)
Scenario 2:
Step1: I have a publisher which publishes a message (Say MessageA) to a Topic (Say TopicA) and the subscriber got the MessageA successfully.
Step2: Now the subscriber system is down due to some internal/network issues and there was a MessageA published to TopicA. When the subscriber system is up and running how to reclaim the earlier MessageA which was published to TopicA when the subscriber system was down?
This is to ensure that even there is a failover on the subscribers it still receives the Enqueued messages.
Thanks for your edit! This edit will be visible only to you until it is peer reviewed.
I'm new to JMS pub/sub using Spring boot and Apache Active MQ . Could you please help to understand the below scenarios?
Scenario 1:
Step1: I have a publisher which publishes a message (Say MessageA) to a Topic (Say TopicA) and during the time it was published there were no subscribers/ consumers, hence the message goes to Messages Enqueued in Apache Active MQ.
Step2: I have a new subscriber now to the TopicA, how to claim the earlier MessageA which was already Messages Enqueued in Apache Active MQ?
My Conclusion: Earlier nobody subscribed and hence you may not get the MessageA. (Please correct if I’m wrong)
Scenario 2:
Step1: I have a publisher which publishes a message (Say MessageA) to a Topic (Say TopicA) and the subscriber got the MessageA successfully.
Step2: Now the subscriber system is down due to some internal/network issues and there was a MessageA published to TopicA. When the subscriber system is up and running how to reclaim the earlier MessageA which was published to TopicA when the subscriber system was down?
This is to ensure that even there is a failover on the subscribers it still receives the Enqueued messages.
My Producer code:
@Bean
public JmsTemplate jmsTemplate(){
JmsTemplate template = new JmsTemplate();
template.setConnectionFactory(connectionFactory());
template.setPubSubDomain(true);
template.setDeliveryMode(DeliveryMode.PERSISTENT);
return template;
}
My Consumer code:
@Bean
public JmsListenerContainerFactory<?> jsaFactory(ConnectionFactory connectionFactory,
DefaultJmsListenerContainerFactoryConfigurer configurer) {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
factory.setPubSubDomain(true);
factory.setSubscriptionDurable(true);
configurer.configure(factory, connectionFactory);
return factory;
}