How to create Spring Integration Flow from two MessageProducerSpec?

前端 未结 1 1845
误落风尘
误落风尘 2021-01-14 00:45

I am using Spring Integration, Java DSL (release 1.1.3) I have my org.springframework.integration.dsl.IntegrationFlow defined as follows

 return         


        
相关标签:
1条回答
  • 2021-01-14 01:09

    There is no reason to do that in Spring Integration.

    You always can output different endpoints to the same MessageChannel.

    Therefore you should have several simple IntegrationFlows for all those messageProducerSpec and finish them with the same channel, where also should be the main flow which will listen from that channel:

    @Bean
    public IntegrationFlow producer1() {
          return IntegrationFlows.from(messageProducerSpec1) 
            .channel("input") 
            .get();
    } 
    
    @Bean
    public IntegrationFlow producer2() {
          return IntegrationFlows.from(messageProducerSpec2) 
            .channel("input") 
            .get();
    } 
    
    ...
    
    @Bean
    public IntegrationFlow mainFlow() {
          return IntegrationFlows.from("input") 
            .handle(handler) 
            .handle(aggregator) 
            .handle(endpoint) 
            .get();
    } 
    
    0 讨论(0)
提交回复
热议问题