开发者

How can I get content from Exchange.In:Body object from a ProcessDefinition in Camel

I am integrating data between two systems using Apache Camel. I want the resulting xml to be written to an xml file. I want to base the name of that file on some data which is unknown when the integration chain starts.

When I have done the first enrich step the data necessary is in the Exchange object.

So the question is how can I get data from the exchange.getIn().getBody() method outside of the process chain in order to generate a desirable filename for my output file and as a final st开发者_运维百科ep, write the xml to this file? Or is there some other way to accomplish this?

Here is my current Process chain from the routebuilders configuration method:

from("test_main", "jetty:server")

.process(new PiProgramCommonProcessor())

.enrich("piProgrammeEnricher", new PiProgrammeEnricher())

// after this step I have the data available in exchange.in.body .to(freeMarkerXMLGenerator)

.to(xmlFileDestination) .end();

best regards RythmiC


The file component takes the file name from a header (if present). So you can just add a header to your message with the desired file name.

The header should use the key "CamelFileName" which is also defined from Exchange.FILE_NAME.

See more details at: http://camel.apache.org/file2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜