m子中不同流的同步 [英] Synchronization of different flows in mule

查看:52
本文介绍了m子中不同流的同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have 2 flows, A.flow and B.flow, eventually both flows execute the same java class.

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

A & B read from a separate Queue.

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

I want to synchronize the flows so that if both flows get input simultaneously then one flow at a time process and after it finishes, the other flow will start processing.

有什么想法吗?

谢谢

推荐答案

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

Use a pooled component and configure it to use one thread at a time:

<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

这篇关于m子中不同流的同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆