What is the Choice Router and how is it configured?
Suggested answer
The Choice Router is Mule's conditional branching construct (equivalent to if-else). Configuration:
1. When conditions: One or more branches with a DataWeave expression. The first When branch whose expression evaluates to true is executed; others are skipped.
2. Default route: Executed when no When condition is true (equivalent to else). If no Default and no condition matches, an error is thrown. Only one route executes per message. Use cases: routing based on HTTP method, content type, field value, or customer tier. DataWeave expression example: #[payload.orderType == 'RUSH']. After the router, execution continues in the main flow. Variables/payload set inside a When branch are available after the router. Commonly used to split processing for different message types from a single endpoint.
Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.
Community comments (0)
No comments yet.
Sign in or create a free account to add a comment. Comments are moderated before they appear.