0

I would like to achieve something like below:

from("direct:dataload")                 
                .beanRef("headerUpdater")
                .log("Log: " + simple("${in.header.contentType}").getText())                    
                //.unmarshal().beanio(simple("${in.header.contentType}").getText(), "content")
                .unmarshal(new BeanIODataFormat(
                        "file://C://Users//admr229//Documents//mappings.xml", "clients"))
                .to("bean:headerFooterValidator")
                .split(body())
                .process(dataValidator).choice()
                .when(header("error").isNotNull())
                .to("seda:saveErrorsForReport").otherwise()
                .to("seda:updateLive")
                .end();

I have commented out the line which I cannot make. I wanted to pass dynamic values from previous endpoint's output to initialize beanio. Only thing I can think of is using recipient list which will dynamically choose a predefined endpoint. Because, for my case, that endpoint will have unmarshall with beanio, unlike something like "activemq:queue:test", which is purely text. I hope I have made my question clear. Please let me know if you need any further details. I am using camel 2.15.2

4

2 回答 2

2

您可以使用数据格式组件 [1],您可以在其中指定 beanio 作为数据格式,并构建 uri 动态 [2]

[1] - http://camel.apache.org/dataformat-component.html

[2] - http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html

于 2015-08-21T09:31:22.350 回答
0

你可以使用做这样的事情,但我想这不是动态的,因为它需要在启动上下文之前设置属性。

.unmarshal().beanio(映射,流名)

于 2016-05-27T13:40:07.330 回答