ActiveMQ Message Expiration

When a message is produced, you can specify its timeToLive in milliseconds. This duration is added to the message every time when the message failed to be consumed. If there is no attempt to consume the message (i.e. consumer detached) within the next TTL duration, the message is considered expired.

There are different strategies to handle expired messages by the broker. The broker can be configured to automatically discard the expired message

    <sharedDeadLetterStrategy processExpired="false" />

or keep it into the DLQ for another configured period of time(the example below uses 5 minutes)

    <sharedDeadLetterStrategy processExpired="true" expiration="300000" />

The sharedDeadLetterStrategy above can be replaced by individualDeadLetterStrategy.

This entry was posted in Java and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s