6.2Choice
Choice is Mule's equivalent of:
if (...) {
...
} else if (...) {
...
} else {
...
}
Example requirement:
Premium customers go through one Salesforce process, standard customers another.
Conceptually:
Choice
│
├── when customerType == "Premium"
│ ↓
│ premium flow
│
├── when customerType == "Standard"
│ ↓
│ standard flow
│
└── otherwise
↓
error/default
Mule XML conceptually:
<choice>
<when expression="#[payload.customerType == 'Premium']">
...
</when>
<when expression="#[payload.customerType == 'Standard']">
...
</when>
<otherwise>
...
</otherwise>
</choice>
The expression is DataWeave.