lukisp
lukisp

Reputation: 1081

Mule one flow per time

I have flow where as inbound endpoint I have VM Queue. Now I want to run process as:

  1. VM inbound endpoint gets a message and starts a long running processing flow
  2. on VM inbound endpoint it then comes another messages (eg 10 messages) that would start another long running process but VM will keep the message in the queue until the first has completed
  3. Every message on VM queue has timeout to removed from queue after this time

How can I do this in MuleESB ?

Upvotes: 0

Views: 1171

Answers (1)

Pontus Ullgren
Pontus Ullgren

Reputation: 705

If it is a asynchronous flow you can use a processing strategy to limit the number of threads running a specific flow.

<queued-asynchronous-processing-strategy name="allowOneThread" maxThreads="1"/>

<flow name="OnlyOneAtTheTime" processingStrategy="allowOneThread">
    <vm:inbound-endpoint path="requestQueue" exchange-pattern="one-way" />
    <logger level="ERROR" message="Before sleep : #[payload]"/>
    <!-- Simulate long running processor -->
    <component class="Sleep" />
    <logger level="ERROR" message="After sleep : #[payload]"/>
    <vm:outbound-endpoint path="responseQueue"/>
</flow>

See the Mule documentation on processing strategies.

Upvotes: 1

Related Questions