activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stirlingc <>
Subject Observing messages passing through a queue
Date Tue, 03 Nov 2009 00:43:02 GMT


I have an architecture in which one or more message producers place messages
in a shared queue and a consumer pool processes the messages.   While I can
use JMX to monitor the number of messages produced and consumed, the
messages are consumed so fast that I often can't browse them with JMX.

To monitor the system and debug issues, I would like to keep a JMX-viewable
history of the most recently produced messages.  My thoughts were to use a
composite destination so that any message placed in the shared queue are
replicated to another queue without any consumers.

The problem is that I would like to cap the size of this historical queue,
preferably by count (e.g., only store the last 200 messages that were sent). 
Alternatively, I could use message time-to-live (TTL) to age the messages
within the queue.  The problem with TTL is that it must be set by the
message producer and would therefore impact both the shared and historical
queues.  Ideally, I'd like to configure the composite destination to set the
TTL only on the messages replicated to the historical queue.  Unfortunately,
it seems like the only way to do this is to create a consumer for the
"primary" historical queue which simply sets the TTL and forwards the
messages to a "secondary" historical queue.

So here are my questions:

1) Is it possible bound the queue size so that if a new message and the
queue size is exceeded, the oldest message in the queue is removed/expired? 
E.g., make a rollover queue that shows just the last 200 messages sent.  I
imagine this can be done with application code and a queue browser, but I'd
prefer to achieve it with configuration.

2) If a fixed size is not possible, can the time-to-live on a message be set
as a property of the queue's configuration rather than the message, or as a
property applied during resolution of a composite destination?

3) Is there a better way to achieve my goal of creating a JMX-viewable
bounded history of a queue's contents?

Thanks for taking the time to read this,

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

View raw message