Contact Free trial Login

Until Successful Scope

The Until Successful scope processes the components within it, in order, until they succeed or exhaust the maximum number of retries. Like all Core components other than Async, Until Successful runs synchronously. If a component within the scope fails to connect or produce a successful result, Until Successful retries the failed task until all configured retries are exhausted. If a retry succeeds, the scope proceeds to the next component. If the final retry does not succeed, Until Successful produces an error.

Common processes that use Until Successful include:

  • Dispatching to outbound endpoints, for example, when calling a remote web service that might have availability issues.

  • Executing a component method, for example, when executing on a Spring bean that may depend on unreliable resources.

  • Using a sub-flow to re-execute several actions until they all succeed.

The Until Successful scope provides fields described in this table:

Attribute Description

Max Retries (maxRetries)

Specifies the maximum number of retries that are allowed. This attribute can be either a number or an expression that resolves to a number. An error message looks like this: Message: 'until-successful' retries exhausted. The Mule error type is MULE:RETRY_EXHAUSTED.

Milliseconds Between Retries (millisBetweenRetries)

Specifies, in milliseconds, the minimum interval between two retries. The actual interval depends on the previous execution, but it should not exceed twice this number. The default value is 60000 milliseconds (one minute). This attribute can be either a number or an expression that resolves to a number.

This XML example allows for up to five retries each second, the default. Note that doc:id attributes are removed to make the example more readable.

<flow name="untilsuccessfulFlow">
  <scheduler doc:name="Scheduler" >
    <scheduling-strategy >
      <fixed-frequency frequency="30" timeUnit="SECONDS"/>
  <until-successful maxRetries="5" doc:name="Until Successful">
    <!-- A single processor here -->
    <http:request method="GET" doc:name="Request"
  <logger level="INFO" doc:name="Logger" />

Variable Propagation

Every execution of the Until Successful scope starts with the same variables and values present before the execution of the block. New variables or modifications to already-existing variables while processing one element are not visible in the next execution (in case there is an error). If the execution finishes correctly, the variables (and payload) are propagated to the rest of the flow.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub