activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Black" <>
Subject RE: Durable Topic, only most-recent message needed
Date Thu, 02 May 2013 14:57:30 GMT
Sound to me like you want a database and not ActiveMq.

Producer inserts a record and deletes all previous (in that order in 1
transaction with rollback to assure that clients can always retrieve a

Use a date/time for the key.

Clients retrieve the last key in the table.

#1 Clients always have a record available even if the producer is not
#2 Messages survive producer crash/restart

-----Original Message-----
From: Andrea Arcuri [] 
Sent: Thursday, May 02, 2013 4:24 AM
Subject: Durable Topic, only most-recent message needed

  I am new to ActiveMQ. Reading documentation and playing with examples. But
there is a key scenario I need to implement, but not sure if ActiveMQ can
support it, and, if it does, how.

- Client publishes topic to broker
- Only most recent message on topic is needed
- Messages can be very large (in the order of megabytes), so shouldn't store
on disk any old message that is not needed any more. but need persistency in
case producer/embedded broker process is restarted
- At the time the producer does publish a message on topic, there might be
no consumer in the network yet. Consumers might appear hours/days later, and
should pick up (for performance reasons) automatically only the most recent
message, as the previous ones are not needed
- the producer might publish 1-4 messages a day, but there might be periods
of few days with 0 messages. there is only one producer, but an unknown,
unpredictable, dynamic number of consumers 

On a MessageProducer, I guess I can set a
setDeliveryMode(DeliveryMode.PERSISTENT) and a very high value for
setTimeToLive (e.g., a month/year). But how to tell ActiveMQ that, once a
new message on a topic is published, then all the previous ones are obsolete
and should be removed/not sent?  Does ActiveMQ support such kind of

many thanks



View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message