Flow control
Flow control helps you to control the order of execution of a flow or subflow by routing the message to the same or different processors. Let us learn about the flow control components used in Mule. We will be exploring the following components in this section:
- Choice
- First Successful
- Round Robin
- Scatter-Gather
Let’s get started with the first one, Choice.
Choice
The Choice router helps you select the route based on the condition satisfied. It is similar to the if-else
block or the switch
block in common programming languages.
To configure a Choice router, just drag the component from the Mule palette. By default, it consists of two routes, namely, the one that satisfies the criteria, and the default route to take if the condition is not met. You can drag and drop any other processor from the Mule palette to build upon the route (see Figure 4.28):
Figure 4.28 – A Choice router in Anypoint Studio
...