Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.0.1
-
Fix Version/s: 2.1.1
-
Component/s: Core: Routing / Filters
-
Labels:None
-
Environment:
Mule 1.6 EE on any platforms
-
User impact:High
-
Effort points:1
-
Affects Docs:Yes
-
Migration Impact:I'll add a section in the Migration guide and the Router guide
-
Similar Issues:None
Description
During POC for one of Mule big customer, one of the requirements is to use MulticastingRouter to feed the same payload to multiple endpoints. The execution of these endpoints must be in order. The sample config is the following:
<mule-descriptor name="updateBatchID" implementation="org.mule.components.simple.BridgeComponent">
<inbound-router>
<endpoint address="jms://yourqueue_name" connector="mqConnector" />
</inbound-router>
<outbound-router>
<router className="org.mule.routing.outbound.MulticastingRouter">
<endpoint address="jdbc://setTransmitted" connector="jdbcConnector" />
<endpoint address="jdbc://setLineStatus" connector="jdbcConnector"/>
</router>
</outbound-router>
</mule-descriptor>
the requirement is endpoint of "jdbc://setTransmitted" must be finished before "jdbc://setLineStatus" is triggered.
The solution is to add "synchronous=true" to "<endpoint address="jdbc://setTransmitted" connector="jdbcConnector" />". So the final config will be like:
<mule-descriptor name="updateBatchID" implementation="org.mule.components.simple.BridgeComponent">
<inbound-router>
<endpoint address="jms://yourqueue_name" connector="mqConnector" />
</inbound-router>
<outbound-router>
<router className="org.mule.routing.outbound.MulticastingRouter">
<endpoint address="jdbc://setTransmitted" connector="jdbcConnector" synchronous="true"/>
<endpoint address="jdbc://setLineStatus" connector="jdbcConnector"/>
</router>
</outbound-router>
</mule-descriptor>
We can only order sync endpoint invocations, async invocations can be ordered and we shouldn't try to do so.