4
votes

I have just started using activemq, and I have a question about retroactive consumers, in order to enable this feature you need to have a durable subscription. But what is the difference of a durable subscription with and without retroactive enabled on the topic? the activemq doc says.

http://activemq.apache.org/retroactive-consumer.html A retroactive consumer is just a regular JMS Topic consumer who indicates that at the start of a subscription every attempt should be used to go back in time and send any old messages (or the last message sent on that topic) that the consumer may have missed.

about retroactive consumers. and for durable subscribers:

http://activemq.apache.org/how-do-durable-queues-and-topics-work.html ...So for durable topic subscription, the JMS provider needs to be able to identify S when it shuts down and later on in the future reconnects, so it can know what messages to send to it while it was not running

I dont really see any big differences between durable subscriptions with and without retroactive mode.

Please explain thanks.

1

1 Answers

5
votes

A retroactive consumer is actually not something you do with a durable subscription. Durable Topic Subscribers have all the messages sent to them that are marked persistent saved in the DB until the next time they connect and then those message are dispatched.

For a non-durable topic subscription you can configure the subscription recovery policy and mark tag the consumer as retroactive. When the consumer connects then the broker will send any Topic messages that are in memory to the consumer based on the recovery policy you've configured.

So don't bother messing with retroactive stuff if you are using a durable subscription, since it's not necessary. And don't count on the retroactive consumer to always work since it only operates on messages stored in memory so if the broker is restarted then there's nothing to recover.

A better option in many scenarios is to use Virtual Topics as that will assign a queue for each consumer and messages will be stored in the queue then even when the consumer goes off-line for a bit.