【问题标题】:Dynamic mapping for BeanIO in CamelCamel中BeanIO的动态映射
【发布时间】:2016-05-27 21:40:07
【问题描述】:

我想实现以下目标:

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();

我已经注释掉了我无法创建的行。我想从前一个端点的输出中传递动态值来初始化 beanio。 我能想到的唯一一件事是使用收件人列表,它将动态选择一个预定义的端点。因为,就我而言,该端点将与 beanio 解组,这与纯文本的“activemq:queue:test”之类的不同。 我希望我已经把我的问题说清楚了。如果您需要更多详细信息,请告诉我。 我正在使用骆驼 2.15.2

【问题讨论】:

    标签: apache-camel bean-io


    【解决方案1】:

    可以使用数据格式组件[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

    【讨论】:

      【解决方案2】:

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

      .unmarshal().beanio(mapping, streamName)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-10-08
        • 1970-01-01
        • 2016-10-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-04-02
        相关资源
        最近更新 更多