Contact Free trial Login

Async Scope

The Async scope is a branch processing block that executes simultaneously with the main flow. The main flow continues to execute while it initiates and processes the Async scope. The flow does not have to pause until the last message processor embedded in the asynchronous flow has completed its task.

Async can be useful for executing time-consuming operations that do not require you to send a response back to the initiating flow (such as printing a file or connecting to a mail server).

To facilitate simultaneous branch processing, the Async scope sends one copy of the message it has received to the first embedded message processor in its own processing block. At the same time, it sends another copy of the message to the next message processor in the main flow.


Because the Async scope is executed in a "fire and forgot" manner, the result of the processing within the scope is not available in the main flow.

Async Scopes versus Subflows

Unlike a subflow, an Async scope:

  • Does not inherit the exception strategy of the main flow.

    To handle errors in an Async scope, you should use the Try scope.

  • Processes messages asynchronously.

  • Does not pass data back to the main flow.

  • Exists inline with the main flow thread.

  • Is not called by a Flow Reference component.

  • Is not reusable

Note that even though the Async scope receives a copy of the Mule message, the payload is not copied. The same payload objects are referenced by both Mule messages: One that continues down the original flow, and the one processed by the Async scope.

In other words, if the payload of your message is a mutable object (for example, a bean with different fields in it) and a message processor in your Async scope changes the value of one of the fields, the message processors outside of the Async scope see the changed values.

This example shows the XML for the Async scope.

<async doc:name="Async">
  <!-- One or more processors here -->