Round Robin in Mule 4

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.

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>


© 2020 goformule.com

Share on :

Mule 4:

XML to JSON in mule 4 Web service consumer VM Validation in Mule 4 Until Successful
Sub flow Set Variable & Remove Variable Set Transaction ID Scatter Gather Round Robin
Consume Restful Service CRUD in Mule 4 Parse Template Object to JSON Load Static Resource
JSON to XML Invoke Idempotent Filter ForEach Flat file to JSON
Fixwidth to JSON First Successful File Execute Error Handling
Email Dynamic Evaluate Custom Business Event CSV to JSON Copybook to JSON
Choice Router Async RabbitMQ


Mule 3:


Database Connector Async CXF Attachement XSLT
Mongo DB Cache scope Custom Business Event Gzip Compress Expression
SMTP For Each Expression Javascript Filter Reference
Salesforce Message Enricher Groovy Parse Template Idempotent
VM Poll Invoke Ruby Message
Webservice consumer Python Transformer reference Message Property Not
Collection Aggregator First Sucessful Catch Exception Strategy Reference Exception Strategy Or
Choice Message Chunk Aggregator Choice Exception Strategy Global Exception Strategy Schema Validation
Custom Aggregator Scatter Gather Custom Exception Strategy Batch Processing MEL
M Unit RAML Map Operator API Mocking Dataweave