Nav

About Mule Components

Components determine the logic for processing a Mule event as it travels through a Mule app. Along with connectors and modules, components are the primary building blocks of flows in a Mule app. Examples include the Scheduler, Scatter-Gather, and For Each components.

About Mule Components

Mule apps mimic tradition procedural programming, with the advantage that data mapping is replaced with DataWeave scripts (or visual mapping) instead of complex Java classes and code. However, the core building blocks are the same.

Mule apps are built by combining flows together through connectors (or in the case of Studio, through private flows and sub-flows).

Connectors and Schedulers trigger flows by passing in an event. Other components then transform and process the event though a sequence of linked steps.

These event processing components include individual event processors like a Logger or Transform component, or other outbound connectors that request additional data to be merged with the existing event later in the flow.

To help combine and transform data, event processors can be grouped together to perform other common processing tasks. These groupings are categorized as Routers or Scopes.

A Scope (blue color in Design Center) groups a sequence of event processors together to apply some programming behavior to that isolated sequence of event processors.

For example, a Try scope lets you isolate and handle any errors that occur in a particular sequence of flows. So, you might wrap an outbound HTTP Request connector (and perhaps some other surrounding components before and after the HTTP Request connector, such as a Transform Message component or a Logging component) in a Try scope, so if an error results, you can apply logging or compensation logic specific to that grouping of components.

A For Each scope takes a collection of data, usually extracted from the current input event, and applies the same sequence of event processors to every item in the collection. For example, a For Each scope might be used to process each individual row returned from a database query or each individual line from a CSV file.

A Router (yellow color in Design Center) takes the input event and routes it to one or more separate sequences of Mule components. For example, a Choice router applies DataWeave logic to pick one of several routes, where each route is a separate sequence of event processors. A Scatter-Gather router copies the input event to every route, and each route independently processes the event. After every route has processed the event, the results from all the routes are combined together into one output event.

Both Anypoint Studio and Anypoint Design Center provide visual ways to build flows with these categories of Mule components.

Additional Mule Components Only in Anypoint Studio

Anypoint Studio provides additional and more complex components, as well as the ability to code more complex behavior and logic in a single Mule app.

First, Anypoint Studio projects can have multiple flows and can divide those flows between multiple Mule configuration files. To achieve the same goals in Design Center, you would have to code and deploy separate Mule apps.

Anypoint Studio flows can reference each other, even in other Mule configuration files. This avoids the need to connect flows together with a connector such as Anypoint MQ, HTTP, FTP, or another connector type.

Additional event processors include Parse Template, and dedicated components for explicitly setting and removing parts of the Mule event, such as Set Variable, Remove Variable, and Set Payload.

Not that you can set and remove variables and set payloads in Design Center, but you do this inside other components rather than in a standalone component.

Additional routers include the Scatter-Gather, Round Robin, and the First Successful router.

Additional scopes include the Async, Cache, Flow, Sub Flow, and Until Successful.

Anypoint Studio projects can also include custom Java Spring beans or other Scripting languages to build customized components.