rst
rst

Reputation: 339

Mule Exhausted Action RUN vs WAIT. Which one to choose and when

I have a question on Mule threading profile Exhausted_Action. From the documentation, I understand that when the action is WAIT, any new request beyond the maxActive will wait for a thread to be available. Whereas action of RUN, would cause use the original thread to process the request. From my understanding, I thought WAIT is better way to do it, rather than RUN. However, it appears MULE has all default values set to RUN. Just want to hear for comments on my understanding and differences between these two actions and how to decide which one to use when.

Upvotes: 3

Views: 834

Answers (1)

user1760178
user1760178

Reputation: 6717

Your undertanding about WAIT and RUN is correct.

Reason why all the default values are RUN is that, The message processing is not stopped because of unavailability of flow thread. Because the original thread(or receiver thread) is anyway waiting for the Flow thread to take the message and process, why not process it. (This is my opinion).

But there is a downside for using RUN.

Ex:

 No of receiver threads are restricted to 2.
 <asynchronous=processing-strategy name="customAsynchronous" maxThreads="1" />
 <flow name="sample" processingStrategy="customAsynchronous" >
    <file:inbound-endpoint ......>
    ............
    ..........
 </flow>

File sizes: 1MB, 50MB, 100MB, 1MB, 5MB.

In the above flow when there are 5 files coming in. 3 files are processed as there is 1 flow thread available and 2 File Receiver threads (Exhausted_Action = RUN). The flow thread will finish the processing fast as the first file is small and keeps waiting for the next message. Unfortunately the receiver thread whose job is to pick the next file and give it to Flow thread to process is busy processing the BIG file. This way there is a chance of receiver threads getting struck in time consuming processing while the flow threads are waiting.

So it is always depending on the usecase you are dealing with.

Hope this helps.

Upvotes: 4

Related Questions