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 shouldn’t be processed?

image

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 or which allows to set a time-to-live value on messages sent to the broker. The AWS SQS supports message expiration using its message visibility settings.

When using message expiration then mind about keeping clock’s synchronized among the systems.

Sample

A message should expire after 5 seconds, if a consumer is not available to receive and process the message.

  from("direct:cheese")
    .to("jms:queueu:cheese?timeToLive=5000");