设置TTL Apache的骆驼的Java DSL [英] Set TTL Apache Camel JAva DSL

查看:146
本文介绍了设置TTL Apache的骆驼的Java DSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置一个消息的TTL?

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

我有这样的事情:

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

我想设定一个时间住在发送的消息。

I want to set a time to live on the message being sent.

推荐答案

我结束了设置创建类似于以下消息的JMSExpiration头字段

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

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

我们使用的是Apache ActiveMQ的5.7。

We are using Apache ActiveMQ 5.7.

这篇关于设置TTL Apache的骆驼的Java DSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆