【问题标题】:Synchronization of different flows in mulemule中不同流的同步
【发布时间】:2014-07-17 05:26:44
【问题描述】:

我有 2 个流,A.flow 和 B.flow,最终两个流都执行同一个 java 类。

A & B 从单独的队列中读取。

我想同步流,以便如果两个流同时获得输入,则一次处理一个流,完成后,另一个流将开始处理。

有什么想法吗?

谢谢

【问题讨论】:

  • 当您说“流程处理相同的 java 类”时,您的意思是消息的消息负载包含相同的 java 对象(类实例)还是它使用相同的 java 对象实例作为处理器在流程中?也许您可以通过一些示例流 XML 来澄清您的问题。

标签: mule


【解决方案1】:

使用池化组件并将其配置为一次使用一个线程:

<flow name="A">
    <jms:inbound-endpoint...>
    ...
    <vm:outbound-endpoint path="process"/>
    ...
</flow>

<flow name="B">
    <jms:inbound-endpoint...>
    ...
    <vm:outbound-endpoint path="process"/>
    ...
</flow>

<flow name="process">
    <vm:inbound-endpoint path="process"/>
    <pooled-component class="org.my.PrototypeObject">
        <pooling-profile exhaustedAction="WHEN_EXHAUSTED_WAIT" initialisationPolicy="INITIALISE_ALL" maxActive="1" maxIdle="1" maxWait="1000" /> </pooled-component>
    </pooled-component>
</flow>

来源:http://www.mulesoft.org/documentation/display/current/Configuring+Java+Components#ConfiguringJavaComponents-ConfiguringaPooledJavaComponent

【讨论】:

  • 这个组件必须在流 A 和 B 引用的第三个流(不是子流)中,对吧?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-03-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多