javajmsactivemq-classicjms-topic

At what point in time is a message removed from a topic?


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.


Solution

  • 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.