1
votes

I will be publishing to a single Activemq Topic and I will have many subscribers consuming from this Activemq. Some of my subscribers may connect at a later date, but when they do I want them to receive ALL MESSAGES ever published to that Activemq topic. How do I do this and what is this pub-sub type called where you get a full picture on first subscribe?

1
I don't know that this is possible. When using topics in ActiveMQ, you have to tell it who the hosts are ahead of time so that it knows how long to hang onto a message for. In your case, you want them to be hung onto forever, which defeats part of the purpose of ActiveMQ. It's a message queue, not a database. Messages are meant to be disposed of. - bstempi
I think I found something. Retroactive is the keyword. Currently testing if it is what I'm looking for. This should be feasible since Activemq has a database built into it (kahadb). - Thirlan
Basically what you are then doing is make your db grow indefinately. Sooner or later performance will be pretty bad. Activemq is designed to store messages for a short time only. - Christian Schneider
I understand Christian. We decided we need only an hour on retroactive. However we can't seem to get retroactive to work in camel. - Thirlan

1 Answers

1
votes

It's typically a lot better to create a separate initial load service. New clients connecting and wanting years of missed updates can trigger some sync from the source application and receive these message through some other channel (a queue for instance). Once up to sync, you simply use durable subscribers on your topic to guarantee that you miss no further updates.

ActiveMQ is not really built to store huge amount of data in the middle for long term. Kahadb is not like a regular database (although you can back it with a JDBC data source if you wish). Storing messages long term in MOM software is actually an anti-pattern.