Spring integration - passing data between flows

时间:2017-06-20 12:35:02

标签: java spring spring-integration spring-integration-dsl

I have a special IntegrationFlow configured like

@Bean
public IntegrationFlow setupRabbitFlow() {
    return IntegrationFlows.from(myInputChannel)     
            .handle((p, h) -> rabbitPublisher.publishToRabbit(p, h))
            .get();
}

and some other flow that processes incoming data from some XML files, e.g. as shown here Polling from file using Java DSL - compile error when adding Files.inboundAdapter. By the end of that flow I want to pass Message to the abovementioned rabbit-sending "sink". How do I declare this?

1 个答案:

答案 0 :(得分:1)

Spring Integration中的第一类公民之一是MessageChannel抽象。

Spring Integration组件(端点)之间的任何交互都是通过消息通道完成的。

您在第二个流程中需要的是在该流程的最后指定.channel(myInputChannel)。并且XML处理的结果将发送到您的第一个流程。