jmsactivemq-classicdurable-services

JMS: When a durable mssage is removed from topic


I'm using ActiveMQ JMS implementation with Spring, and just switched from queue model to topic model, because my JMS clients increased from one to many. Topic subscribers should be durable, because clients may become unavailable in some circumstances.

I don't understand when does a persistent message get removed from a topic. Underlying engine is not aware how many subscribers may receive from that topic, so when does it remove the message from its internal database? Is it done in a time-based manner?


Solution

  • If you register a new durable subscriber to a topic, the broker server will keep track of that subscription and keep the messages around until every single subscriber (with a unique subscriber id) has successfully consumed the message.

    It's pretty similar to have the message copied to a unique queue per receiver.

    Underlying engine is not aware how many subscribers may receive from that topic

    -- Yes it is aware, since the subscriptions are durable