First Successful Router in Mule 4

What is first successful ?

  • First successful router iterates through list of configured processing routes until one of the route executes successfully.

  • If any of the route fails , it goes to the next configured route.

  • If none of the routes in this router component give a success response then the router component throws an error response.

Example:

  1. Create a new mule project and use first successful router from mule palatte.

  1. In the below example , add the first successful router and add three routes.

    First route is to read the file. Second and third route is to set the payload.

  2. If the first route fails then it executes the second route.

  1. Test the flow using the endpoint