Use Exchange Property in Camel DSL quot;toquot;(在 Camel DSL “to 中使用 Exchange 属性)
问题描述
我想在 Camel Exchange 上设置一个属性,然后在保存文件时使用该属性.在我的骆驼 dsl 中,我有以下内容:
I want to set a property on a Camel Exchange and then use this property when saving the file. In my camel dsl I have the following:
.process(processorToSetExhangeProperty) // sets the property <uid> on the exchange
.to("file:/tmp?fileName=file-" + property("uid") + ".xml")
文件被保存为:
"file-property{uid}.xml" though
我的处理器如下:
@Override
public void process(Exchange exchange) throws Exception {
UUID uuid = UUID.randomUUID();
exchange.setProperty("uid", uuid.toString());
exchange.setOut(exchange.getIn());
}
对可能出现的问题或如何实现这一点有任何想法吗?
Any thoughts on what may be going wrong or how I can achieve this?
推荐答案
Camel 中的 to
在运行时不会被解释.
The to
in the Camel is not interpreted at runtime.
如果你想动态构建你的URI,你应该使用recipientList.请参阅 https:///camel.apache.org/manual/latest/faq/how-to-use-a-dynamic-uri-in-to.html
You should use recipientList if you want to construct your URI dynamically. See https://camel.apache.org/manual/latest/faq/how-to-use-a-dynamic-uri-in-to.html
这篇关于在 Camel DSL “to" 中使用 Exchange 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Camel DSL “to" 中使用 Exchange 属性


- Eclipse 插件更新错误日志在哪里? 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01