MuleSoft Technical Guides

Until Successful Scope in Mule 

User MuleSoft Integration Team
Calendar March 12, 2021

“Until Successful” is the scope for executing a  set of components as one unit.

It processes all the components within it until they produce a successful result. If one processor within the scope fails, it retries the enclosed processors again. The number of retries is configurable and decided by the user.

Configuration

  1. Design a new flow and configure an HTTP listener for it.
  2. Create one more flow using the same HTTP Config but listening on a different path.
  3. From the first row, call the second flow using HTTP Requester.

  1. Wrap the HTTP requester under Until Successful Keep the default values for Max  Retries and Milliseconds Between Retries.

until-successful-properties

  1. To test the flow, change the initial state of the second flow to stopped and run.
  2. The requester will fail, and the scope will retry five times before throwing the error.

 

<flow name="until-succesfullFlow" >

                        <http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/us"/>

                        <until-successful maxRetries="5" doc:name="Until Successful" >

                                    <http:request method="GET" doc:name="Request" config-ref="HTTP_Request_configuration" path="/us-demo"/>

                        </until-successful>

                        <logger level="INFO" doc:name="Logger" message="Success"/>

            </flow>

            <flow name="until-succesfullFlow1" initialState="stopped">

                        <http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/us2"/>

                        <logger level="INFO" doc:name="Logger" message="US2 flow"/>

            </flow>

 

Variable Propagation

New variables created within the scope are not available for the subsequent execution, and any modifications to variables created outside the scope are not available to the subsequent execution. Each execution cycle starts with a fresh set of variables.

 

Thanks for reading. Find more MuleSoft Best practices at Caelius Consulting Resource Centre.

 

Leave a comment

Your email address will not be published. Required fields are marked *