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 attempted. An error message looks like this: Message: 'until-successful' retries exhausted. The Mule error type is MULE:RETRY_EXHAUSTED.

Milliseconds Between Retries (millisBetweenRetries)

Specifies the minimum interval between two attempts to process, in milliseconds. The actual interval depends on the previous execution, but should not exceed twice this number. The default value is 60000 milliseconds (one minute).

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"/>
    </scheduling-strategy>
  </scheduler>
  <until-successful maxRetries="5" doc:name="Until Successful">
    <!-- A single processor here -->
    <http:request method="GET" doc:name="Request"
      config-ref="HTTP_Request_configuration"
      url="https://jsonplaceholder.typicode.com/users"/>
  </until-successful>
  <logger level="INFO" doc:name="Logger" />
</flow>

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.

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.