Message Expiration

Camel supports the Message Expiration from the EIP patterns.

How can a sender indicate when a message should be considered stale and thus should not be processed?


Set the Message Expiration to specify a time limit how long the message is viable.

Message expiration is supported by some Camel components such as JMS, which uses time-to-live to specify for how long the message is valid.

When using message expiration, then mind about keeping the systems clocks' synchronized among the systems.


A message should expire after 5 seconds:

  • Java

  • XML

    <from uri="direct:cheese"/>
    <to uri="jms:queue:cheese?timeToLive=5000"/>