【问题标题】:parallel execution in spring integrationSpring集成中的并行执行
【发布时间】:2017-11-22 09:20:23
【问题描述】:

需要在 spring 集成中加入类似线程的功能。如果 3 个线程完成,则执行第 4 个线程。如图所示,3个出站网关并行运行,第4个出站只有在前3个执行后才会运行。

但是,我没有做拆分器/聚合器,所以不需要。我猜也不需要任何链式操作,因为它会按顺序执行。

并行执行然后等待执行完成

<int:publish-subscribe-channel id="publishsubscribechannel"
    task-executor="executor" />
<task:executor id="executor" pool-size="10" />
<int-http:inbound-channel-adapter
id="httpOrderCreateInboundAdapter"
    channel="orderCreateInboundChannel" path="/input"
    supported-methods="GET, POST"
</int-http:inbound-channel-adapter>

<int-http:outbound-gateway id="micros1" request-
channel="publishsubscribechannel"
reply-channel="channel1"
</int-http:outbound-gateway>

<int-http:outbound-gateway id="micros2" request-
channel="publishsubscribechannel"
reply-channel="channel2"
</int-http:outbound-gateway>

<int-http:outbound-gateway id="micros3" request-
channel="publishsubscribechannel"
</int-http:outbound-gateway>


<int-http:outbound-gateway id="micros4" request-channel="channel2"
reply-channel="channel4"

 </int-http:outbound-gateway>

【问题讨论】:

    标签: spring spring-integration


    【解决方案1】:

    考虑为该发布-订阅通道使用Scatter-Gather 组件。是的,您的所有网关都必须返回其回复通道标头,以便收集器从它们那里收集回复。真正在那之后,您将能够继续访问Outbound4

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-02-24
      • 1970-01-01
      • 1970-01-01
      • 2012-06-15
      • 1970-01-01
      • 1970-01-01
      • 2015-09-22
      • 2016-05-21
      相关资源
      最近更新 更多