I have two instances of my app subscribing to a topic. Since there are two instances(i.e two subscribers), two events(messages) will be generated and written to a queue. (Now i have duplicate message in the queue and one by one each is going to be processed) But I want to have a solution where only one event is processed/or only one message is written to the queue. How can i achieve that?. I must have two subscribers instead one goes down
JMS topics follow publish-subscribe semantics where every subscriber will get the message. However, JMS queues follow point-to-point semantics where only 1 of the connected consumers will receive the message. Therefore, if you want the message to be consumed by only one client then all of your consumers should be connected to a JMS queue rather than a topic.