Contact Free trial Login

Add Logic, Data Transformations, Error Catching, and More to Flows (Flow Designer)

You can add cards that perform a variety of tasks to change the course of a flow, log messages, transform data, add or remove variables or payloads, and more. These cards represent the core components of Mule applications and are provided by Mule Runtime.

You add card that represent core components in the same way that you add other cards to a flow: by clicking the plus icon that appears after the previous card and then selecting the new card from a list, as in this image:

fd supported core components
Figure 1. The core components that are supported in Flow Designer

Flow Designer supports the following core components:

Choice

If you want a flow to evaluate data to determine which route among several to send the data to, use a Choice core component.

fd choice
Figure 2. A Choice card being used in a flow
  1. A card passes its output to a Choice card. The card uses an expression to evaluate the data and follows this logic:

    • If the data is x, the card routes the data to one subflow.

    • If data is y, the card routes the data to a different subflow.

    • If the data is the default value that you set in the card, the data is routed to the default subflow.

  2. The output of the subflow is sent to the card that follows the Choice card.

Flow Ref

By placing a Flow Ref core component in a flow, you can execute one flow from another within the same application. See Reference One Flow from Another with Flow Ref.

Foreach

The For Each core component splits a payload into elements and processes them one by one through the components that you place in the scope. It is similar to a for-each/for loop code block in most programming languages and can process any collection, including lists and arrays. The collection can be any supported content type, such as application/json, application/java, or application/xml. The output payload is the same as the input.

fd foreach
Figure 3. A Foreach card being used in a flow
  1. A card passes its output to a Foreach card, which splits the payload into its constituent elements and processes each one.

  2. The Foreach card passes to the next card the same data that it received as input from the previous card.

Logger

By adding one or more Logger cards to a flow, you can monitor the flow of data through a running Mule application or even debug a Mule application by logging important information at runtime, such as error messages, status notifications, and payloads. Logger cards can be placed anywhere in a flow. You can log a string that you specify, the output of a DataWeave expression you compose with the help of the Custom Expression dialog, or any combination of strings and expressions.

The output of the Logger card goes to the Logs pane, which you can open by clicking the Logs tab in the bottom-right corner of Flow Designer.

Remove Variable

The Remove Variable core component takes the name of a variable and removes the variable from a flow.

Set Payload

The Set Payload core component lets you modify the payload in the current data at a point in a flow. You can replace the payload with a string, or you can modify or replace it with a DataWeave expression.

Set Variable

You can use a Set Variable core component to create a variable that stores all of the output from the preceding card, stores part of the output, or manipulates the output by using functions in a DataWeave expression. You can then reuse that value in a later card by using the variable. See Store All or Part of the Output of a Card in a Variable.

Transform

The Transform core component converts input data to a new output structure or format.

Try

You can put specific parts of a flow that are prone to errors inside Try card. If an attempt to use the part of the flow in Try fails, Try can catch the errors and apply a fix or an alternative. See Handle Errors with Try.

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.