Set TTL Apache Camel JAva DSL

允我心安 提交于 2019-12-02 07:47:49

I ended up setting the JMSExpiration header field of the messages being created similar to the following

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

We are using Apache ActiveMQ 5.7.

I assume TTL means Time to Live.

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

You should check the documentation for the component you use, what it supports.

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

And mind about the problem with "client and server clock's can be out of sync". There is some details on the Camel JMS page. Some message brokers has ways to sync the clocks, such as Apache ActiveMQ with its timestamp plugin: http://activemq.apache.org/timestampplugin.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!