Spring Integration DSL - 如何创建XPath Splitter?

时间:2016-03-22 02:19:53

标签: xpath spring-integration dsl splitter

如何使用Spring Integration DSL创建XPath Splitter?什么是DSL的等价物:

<!-- Split the order into items creating a new message for each item node -->
<int-xml:xpath-splitter id="orderItemSplitter"
                   input-channel="orderChannel"
                   output-channel="orderItemsChannel">
    <int-xml:xpath-expression expression="/order/items"/>
</int-xml:xpath-splitter>

1 个答案:

答案 0 :(得分:0)

Spring Integration Java DSL没有任何<xpath-splitter>特定组件,因为它足以通过常规Java配置轻松配置:

@Bean
public AbstractMessageSplitter xpathSplitter() {
    return new XPathMessageSplitter("/order/items"); 
}

...

@Bean
public IntegrationFlow xpathFlow() {
return IntegrationFlows.from("inputChannel")
            .split(xpathSplitter())
            .get();
}