activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbekas <>
Subject Re: Queue PolicyEntry Eviction Not working
Date Mon, 13 Apr 2009 23:38:16 GMT

yesnid wrote:
> I have tried this with a TTL of 0 essentially infinite for the message and
> for non-zero values, but neither yielded any results for me. Also My queue
> that I am trying to evict from has no consumer on it, does that make a
> difference, I am beginning to suspect from other posts that it is? 
> Could you post a configuration that has worked and I could try this and
> see if I get better results with eviction?

You do not need a consumer to expire the messages.  However, the messages
will just sit there (expired) unless some activity occurs on your queue to
tell ActiveMQ to purge the old messages.  For testing purposes, I wrote a
slow consumer (1 message per second) which allows me to rapidly send
messages with a short TTL and be able to watch them expire.

The sample configuration you posted is probably working, but the messages
are sticking around in your queue.  You can try to set an attribute on your
oldestMessageEvictionStrategy parameter, it's called
evictExpiredMessagesHighWatermark.  This gives ActiveMQ the hint that it
should purge expired messages after a set threshold of expired messages has
been met, in this case, 1000.  Without this set, your messages will likely
stick around until ActiveMQ decides that it needs to free up space on your
queue for incoming messages.

evictExpiredMessagesHighWatermark="1000" />

In my test, my slow consumer processes 1 message a second.  So, if I send
1500 messages with a TTL of 1000ms, the consumer should process 1-2
messages, ActiveMQ will expire the rest, and somewhere between 1000-1500
messages will be immediately removed from the queue and placed on the
ActiveMQ.DLQ (the default DeadLetterQueue).  Note, some expired messages
will probably remain on the queue until the high watermark is hit again or
ActiveMQ inspects them and decides to remove them.

I hope that helps.

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

View raw message