使用Exchange物业骆驼DSL"到" [英] Use Exchange Property in Camel DSL "to"
本文介绍了使用Exchange物业骆驼DSL"到"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想设置一个骆驼交易所属性,然后保存文件时使用此属性。在我的骆驼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")
该文件被保存为:
The file is being saved as:
"file-property{uid}.xml" though
我的处理器如下:
My processor is as follows:
@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?
推荐答案
在来中的骆驼是不是在运行时PTED间$ P $。
The "to" in the Camel is not interpreted at runtime.
如果要动态构建你的URI,您应该使用recipientList。
请参见 http://camel.apache.org/怎么办,我使用的动态-URI-在to.html
You should use recipientList if you want to construct your URI dynamically. See http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
这篇关于使用Exchange物业骆驼DSL&QUOT;到&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文