Contact Us 1-800-596-4880

Round Robin Router

This version of Mule reached its End of Life on May 2, 2023, when Extended Support ended.

Deployments of new applications to CloudHub that use this version of Mule are no longer allowed. Only in-place updates to applications are permitted.

MuleSoft recommends that you upgrade to the latest version of Mule 4 that is in Standard Support so that your applications run with the latest fixes and security enhancements.

The Round Robin router iterates through a list of two or more routes in order, but it only routes to one of the routes each time it is executed. It keeps track of the previously selected route and never selects the same route consecutively. For example, the first time Round Robin executes, it selects the first route. The next time, it selects the second route. If the previously selected route is the last route in the list, Round Robin jumps to the first route.

<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
	<flow name="round-robinFlow" doc:id="95d79691-4142-43b1-9719-7d6dc19c40bd" >
		<scheduler doc:name="Scheduler" doc:id="77a281f1-7643-422d-be72-25456b767d68" >
			<scheduling-strategy >
				<fixed-frequency />
			</scheduling-strategy>
		</scheduler>
		<round-robin doc:name="Round Robin" doc:id="6fe1f667-05b2-47d3-81d2-e9ef27f7c9b6" >
			<route>
				<logger level="ERROR" doc:name="Logger" doc:id="e38d4396-d4ea-4eec-88dc-2bf60f579d5d" message="Route1"/>
			</route>
			<route>
				<logger level="ERROR" doc:name="Logger" doc:id="6127fe32-0bc0-48e9-bb18-a9f3bfc45d0b" message="Route2"/>
			</route>
		</round-robin>
	</flow>
</mule>

In the example above, the first time the Round Robin is executed it prints Route1. The next time, it prints Route2. The third time, since there are only two routes, Round Robin starts again with the first route and prints Route1.

Throws

  • MULE:ROUTING