设置 TTL Apache Camel JAva DSL [英] Set TTL Apache Camel JAva DSL

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

问题描述

使用 Java DSL 时如何设置消息的 TTL?

我有这样的事情:

<预><代码>...来自(计时器:某事?延迟=3000&period=15000")....to("{{some.property}}").结尾()...

我想设置发送消息的时间.

解决方案

我最终设置了正在创建的消息的 JMSExpiration 标头字段,类似于以下内容

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

我们使用的是 Apache ActiveMQ 5.7.

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

I have something like this:

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

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

解决方案

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.

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

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