Round robin in Mule 4
Round-robin (RR) is one of the
algorithms employed by process and network schedulers in computing. As the term
is generally used, time slices are assigned to each process in equal portions
and in circular order, handling all processes without priority (also known as
cyclic executive). Round-robin scheduling is simple, easy to implement, and
starvation-free. Round-robin scheduling can also be applied to other scheduling
problems, such as data packet scheduling in computer networks. It is an
operating system concept.
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.
Round Robin flow control sends each message received to the next message processor in the circular list of targets.
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.
Round Robin flow control sends each message received to the next message processor in the circular list of targets.
Flow:
Method: GET
Output:
XML Project code:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" 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
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="52295af7-81a7-4346-894f-e7b2bd82fecb" >
<http:listener-connection host="0.0.0.0" port="8085" />
</http:listener-config>
<flow name="test_roundrobinFlow" doc:id="d170c1ae-6f6b-4a3b-86d4-c2fd0dfd5d33" >
<http:listener doc:name="Listener" doc:id="2ed5e702-bd5d-451e-bf18-d5257bd5d905" config-ref="HTTP_Listener_config" path="/robin"/>
<round-robin doc:name="Round Robin" doc:id="9efdcc62-5b31-41eb-82ce-8c0f1c4717a7" >
<route >
<set-payload value="1" doc:name="Set Payload" doc:id="2a599073-d493-42c5-ba4d-94bd8c4fc909" />
</route>
<route >
<set-payload value="2" doc:name="Set Payload" doc:id="bdcca0eb-e0d2-4030-a425-4675931eddcb" />
</route>
<route >
<set-payload value="3" doc:name="Set Payload" doc:id="3f548054-747f-4982-8940-2033f42fee89" />
</route>
</round-robin>
</flow>
</mule>
No comments:
Post a Comment