I have a topic. I have 10 consumers subscribed for it. As per my understanding, a message will be removed from topic when all consumers have received it. Right? Once it is removed, any further subscriber will not be notified for that specific message. I could not confirm this in the JMS specification anywhere.
2 Answers
A broker (in your case Active MQ) will deliver a publication to all active subscribers, both durable and non-durable (meaning consumer applications which are running when a publication was made on a topic and consuming messages and any durable subscribers which are not active). The broker will then discard the publication. If there are no active subscribers or durable subscribers for a topic, the broker will discard the publication immediately. It will not wait for any subscribers to become active. The only exception is in the case of "Retained Publication" option being exercised, where the broker will cache a publication and deliver to consumers who may arrive later. But note that broker will not wait for all consumers to receive publication before removing it from a topic. I would say there is nothing like 'removing from topic'.
Hope I am clear.
-
You said "But note that broker will not wait for all consumers to receive publication before removing it from a topic" i think you meant that broker will deliver it from its side but does not wait for acknowledgement from consumer whether it received it or not ? – user3198603 Feb 27 '14 at 06:49
-
Depending on Broker implementation each subscriber will some space allocated in the Broker for receiving publications. This space could be a queue. Assuming queues are used, Broker will put the publication into these queues and goes ahead to process publication from Publisher. Now that the messages are in queues, it's up to the consumer to pull the publications from these queues. This is what I meant when I said 'Broker does not wait for consumers to receive publications' – Shashi Feb 27 '14 at 07:14
Only active subscribers will get your message in that case, after that your message is removed. If you want to send your message also to inactive subscribers you can configure durable subscription.

- 2,130
- 9
- 16
-
Jakub i did not get you here.Are you trying to say, for non durable subscription, message will be removed once all active subscriber get the message.For durable subscription, message will be removed only when all active and inactive subscribers get the message.Is that correct? – user3198603 Feb 26 '14 at 17:32
-
Yes, that's correct. Keep in mind that each subscriber gets his own copy of a message. – Jakub H Feb 26 '14 at 19:07