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 属性
基础教程推荐
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
