Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

Routers

Routers (Flow Controls Anypoint Studio) route messages to various destinations in a Mule flow. Some routers incorporate logic to analyze and possibly transform messages before routing takes place. For example, various flow controls can:

  • Split a message into several segments, then route each segment to a different building block.

  • Combine several messages into a single message before sending it to the next building block in the flow.

  • Reorder a list of messages before sending it to the next building block.

  • Evaluate a message to determine which of several possible building blocks it should be routed to next.

  • Broadcast the same message to multiple building blocks.

Common Flow Control Configuration Fields

Flow control configuration requires two or three steps, depending on the specific flow control you configure:

  1. From the Studio Palette, drag a flow control icon to the Message Flow canvas. If you need to re-position the control in the flow; delete the control, then re-insert it in the correct position within the flow.

    FC+Placement

  2. The following flow controls: Choice, All, Round Robin and First Successful are encased inside a processing block (a gray "broken-line" rectangle). After placing one of these flow controls on the Message Flow canvas, you can drag and connect additional building blocks to the flow control. You can add multiple building blocks to the flow control to form a vertical column of building blocks to the right of the flow control (See: below).

    FC+Column

  3. To configure the flow control, double-click the flow control icon to open its properties pane, then supply values for the fields on the various tabs of the properties panes. (All and Round Robin support only the Documentation tab (field), which records your implementation notes for display in the application’s XML configuration file as well as the Help balloon that pops up when you hover your mouse over that flow control).

    FC+Properties

Flow Controls Available in Studio

Some flow controls in the Studio Palette are used to simply pass the message payload to the next building block, while others modify or combine the message payload before sending.

Flow Controls That Do Not Change the Payload

Flow Control Description Documentation

AllRouter-24x16

All

Sends one message to multiple message processors.

All Flow Control Reference

Choice-24x16

Choice

Evaluates a message against specified criteria, then sends it to the first message processor that matches those criteria.

Choice Flow Control Reference

first-successful-24x16

First Successful

Sends a message to the next message processor within a "circular" list of processor targets.

round-robin-24x16

Round Robin

Iterates through a list of two or more message processors, sending successive messages to the next message processor on the list. When it reaches the end of the list, it jumps to the start of the list and resumes the iteration.

Flow Controls That Modify the Payload

Flow Control Description Documentation

collection-aggregator-24x16

Collection Aggregator

Checks the group tag (known as a Correlation ID) attached to each message in a group to create a collection of messages which share the same Correlation ID.

Splitter-24x16

Collection Splitter

Accepts a collection of messages (or parts of messages), splits them into individual messages, then sends each new message, in sequence, to the next message processor in a flow.

custom-aggregator

Custom Aggregator

Lets you write you own Java code to determine how messages are constructed and sent.

chunk-aggregator-24x16

Message Chunk Aggregator

Checks the group tag (Correlation ID) of each message in a collection, selects all the messages whose group tag matches the specified value, then combines those messages into a single message which is then sent to the next message processor in an application flow. This is particularly useful for re-assembling the segments of a long message that has been received as multiple messages, each one consisting of a segment of fixed length created and sent by the Message Chunk Splitter.

chunk-splitter-24x16

Message Chunk Splitter

Sections a message into segments of a specified length, then sends each segment, in sequence, to the next message processor in a flow. This is particularly useful when the message recipient cannot accept messages longer than a specified length.

Resequencer

IAccepts a collection of messages, then uses the Sequence ID of each message to reorder those messages. It then sends the messages (in order of their new sequence), to the next message processor in an application flow.

Splitter-24x16

Splitter

EEvaluates an expression which determines how it sections a message into two or more parts. The Splitter then sends each of these message parts, in sequence, to the next message processor in an application flow.

Splitter Flow Control Reference