Install TTL Apache Camel JAva DSL

How do you set TTL for a message using Java DSL?

I have something like this:

... from ("timer:something?delay=3000&period=15000") ... .to("{{some.property}}") .end() ... 

I want to set the time to live in the message being sent.

-1
source share
2 answers

As a result, I set the JMSExpiration header field of the generated messages, similar to the following

 .setHeader("JMSExpiration", constant(System.currentTimeMillis() + 1000)) 

We are using Apache ActiveMQ 5.7.

0
source

I guess TTL stands for Time to Live.

In Camel, this is a specific component, how they deal with it. Some components support this, while others do not.

You should check the documentation for the component being used that it supports.

If you use the JMS component, it has the timeToLive option, as described: http://camel.apache.org/jms

And the problem with the "client and server clock may not be synchronized." There are some details on the Camel JMS page. Some message brokers have clock synchronization methods, such as Apache ActiveMQ with the timestamp plugin: http://activemq.apache.org/timestampplugin.html

0
source

All Articles