0

I have a blueprint.xml in which I write some routes for an ESB. I want to get values from an XML file passed into the route. I want to then use these values to make up a dynamic property key name and call the properties file and get the matching property (all within the route). I want to avoid having to create a Java processor due to the overhead of instantiating this each time. Essentially I want to do this:

    <from uri="file:C:/myfilelocation?"/>
    <to uri= {{<xpath>//company</xpath>+<xpath>//branch</xpath>}}/>

So in blueprint you call a property using {{}} I am trying to place the xpath values as the property key inside of the property {{}} tags. In my properties file I have a mapping for each company/branch combination like so:

company1branch1=http://thiscompany.com company2branch2=http://someothercompany.com

Any way to do this, e.g. some sort of escape characters?

4

1 回答 1

0

< to > 用于静态 uris,如果你想使用动态运行时计算的 uris,那么你应该使用收件人列表 EIP:http ://camel.apache.org/recipient-list.html允许发送消息到在运行时计算的收件人。

这也是此常见问题解答中的描述:http: //camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

虽然使用 xpath,但您需要先将它们设置为标头。有点像:

<setHeader headerName="company">
   <xpath resultType="java.lang.String">/xxxx</xpath>
</setHeader>
...
<recipientList><simple>{{${header.company}${header.branch}}}</simple></recipientList>

收件人列表也可以发送到 2+ 个目的地,分隔符默认为逗号。但是你可以配置它。请参阅上面的链接。

于 2013-04-25T12:57:48.660 回答