java如何从两个MessageProducerSpec创建Spring集成流?
我正在使用Spring集成,Java DSL(1.1.3版)
我的org.springframework.integration.dsl.IntegrationFlow
定义如下
return IntegrationFlows.from(messageProducerSpec)
.handle(handler)
.handle(aggregator)
.handle(endpoint)
.get();
}
messageProducerSpec
是org.springframework.integration.dsl.amqp.AmqpBaseInboundChannelAdapterSpec
的实例
我希望我的集成流使用来自两个独立的messageProducerSpecs
(两个独立的SimpleMessageListenerContainers
,每个使用不同的ConnectionFactory
)的消息。如何从多个messageProducerSpec构建集成流?我看不到任何集成组件能够使用来自多个源的消息
# 1 楼答案
在Spring集成中没有理由这么做
始终可以将不同的端点输出到同一个
MessageChannel
因此,对于所有这些
messageProducerSpec
,你应该有几个简单的IntegrationFlow
,并用相同的通道完成它们,其中也应该是从该通道监听的主流: