Thursday, January 15, 2009

Mule Single Thread Component Profile

i was searching the net over the last whole weekend to find a solution to a classic problem.
How the Mule Component will act as a single threaded or like a singleton class i.e, only one instance will run at a time.
By default Mule components are pooled so they execute in concurrent fashion.
But if you want only one component should execute at a time here is the configuration.



<mule-descriptor name="FooServiceComponent"
implementation="FooService">
<inbound-router>
<endpoint address="FooDataInput" />
</inbound-router>

<pooling-profile exhaustedAction="WHEN_EXHAUSTED_WAIT"
maxActive="1" maxIdle="1" maxWait="20000" initialisationPolicy="INITIALISE_ALL" />
<queue-profile maxOutstandingMessages="1000" />
</mule-descriptor>

No comments: