Reputation: 2230
I am developing distributed application ( 4 instances are running and controlled by Load balance. each instance is identical. one instance will not depend on another instance and each instance will do all operation ). Application needs to listen one JMS topic called "result". 4 instances are going to listen the same topic with same subscription id. I am using Camel pub sub. what will happen,
if answer is "Yes" for question 2 . will the same instance get message all the time util it goes down?
if answer is "yes" for question 3. will another instance receive the message , since that instance is down ?
I would like to achieve JMS pub sub in distributed application without duplicate message. please address my query and sorry if my question is not clear. let me know i will give more details.
Upvotes: 3
Views: 2570
Reputation: 15273
1) Yes, all instances will get copy of the published message. That is the Publish/Subscribe messaging pattern.
2) No
3) & 4) Not valid as all consumers get the copy of published message.
JMS 2.0 specification describes the concept of Shared Subscription
where more than one subscriber/consumer share (a.k.a load balance) messages published on a topic. All consumers use same subscription id.
If your messaging provider does not support JMS 2.0 yet, then you can create single durable subscription and provide a queue name to which all published messages on the topic will be routed to. All of your consumers can then get messages from that queue. This way messages can be distributed across multiple consumers. Since it's a queue, no two consumers will get the same message.
Upvotes: 1