Skip to content

Latest commit

 

History

History
183 lines (117 loc) · 8.38 KB

File metadata and controls

183 lines (117 loc) · 8.38 KB

Configuring Components

reuse::partial$beta-banner.adoc

Configure connectors and processors within your implementation and integration projects from the canvas or the code editor.

Common tasks include the following:

Before You Begin

  • Determine which connectors and processors you intend to use.

  • Review Get Familiar with the Basics to ensure that you are familiar with important concepts and features.

    Understand the basics of Mule flows, the Mule event structure, including the payload, attributes, and Mule variables. To transform data and add expressions to your components, have some familiarity of the DataWeave language.

Add a Component to Your Project

Set Custom Metadata for a Component

To set custom metadata for a component, add or open the component in the canvas and then apply the metadata using the custom metadata options from the Metadata tab, Expression Builder, or dataweave functions. For more information, see Set Custom Metadata on the Metadata or Data Tab and see Set Custom Metadata in Transformation Builder.

Set Custom Metadata for a component

Refactor Flows Using Canvas Actions

Reorganize and refactor your flows directly from the canvas. Move, copy, and extract components without manually updating the underlying XML.

These actions help you reduce rework, maintain clean flow structures, and safely evolve your implementations as complexity grows.

You can use canvas actions to:

  • Move components within a flow or across files

  • Copy and reuse components in the same or different projects

  • Extract components into a new flow or subflow

When you perform these actions, Anypoint Code Builder automatically updates references, connections, and configurations to prevent broken flows.

Note
Some components can’t be extracted or moved. If a selection includes unsupported components, the available actions are limited to prevent invalid configurations. In some cases, the Extract to Flow option is displayed but no extraction is performed, for example when extraction across scopes isn’t supported.

Extract Components to a Flow

Extract one or more components into a new flow or subflow. This is useful for simplifying large flows or reusing logic.

To extract components:

  1. Select one or more components in the canvas.

  2. Right-click the selection and select Extract to Flow.

  3. Enter a name for the new flow.

  4. Select the target Mule configuration file.

  5. Configure metadata preferences if needed.

  6. Click Extract.

Anypoint Code Builder creates the new flow and replaces the selected components with a Flow Reference in the original flow.

By default, the current file is selected as the target configuration file.

Note
Some components can’t be extracted or moved. If a selection includes unsupported components, the available actions are limited to prevent invalid configurations. In some cases, the Extract to Flow option is displayed but no extraction is performed, for example when extraction across scopes isn’t supported.

Metadata Preferences

When extracting components, you can define metadata preferences for the new flow.

You can configure:

  • Payload metadata

  • Attributes metadata

  • Variables metadata

These settings help ensure that the extracted flow has the correct input structure.

Multi-Selection Behavior

You can select multiple components by holding Shift and clicking components in the canvas.

Validation and Safeguards

Canvas actions include built-in validation to prevent invalid operations.

For example:

  • Extraction is blocked until required metadata is loaded

  • Unsupported components can’t be extracted

  • Actions are disabled while the canvas is loading

These safeguards help ensure that your flows remain valid and executable after refactoring.

Copy Components

You can copy components and paste them in the same flow or in a different file or project.

To copy a component:

  1. Right-click the component. To copy multiple components, press and hold Ctrl (Windows) or Cmd (macOS), select the components, and then right-click a selected component.

  2. Click Copy Component. Or press Ctrl+c (Windows) or Cmd+c (macOS).

  3. Right-click the icon in the current flow or in a different file or project and select Paste Component or press Ctrl+v (Windows) or Cmd+v (macOS). The component and its configuration are pasted in the new location. If multiple components are copied, they’re pasted in the same order as they’re copied.

Note
Some components, like an HTTP Listener, can’t be pasted to certain locations. An error message shows if a component can’t be pasted to the location.

Disable Components

You can temporarily remove components from your flow without deleting them by disabling them directly from the canvas. This action is equivalent to commenting out code in the code editor.

To disable a component:

  1. Right-click a component in the canvas.

  2. Select Disable Component.

Disabled components appear with a dashed outline and a disabled icon. In the code editor, the component is wrapped in an XML comment (<!-- …​ -→), preserving the code but preventing it from executing. Disabled components appear greyed out in the canvas and are ignored at runtime.

Re-enable a Disabled Component

To restore a component: . Right-click the disabled component. . Select Enable Component.

This also removes the comment from the code editor.

If you previously set a breakpoint on a component and then disable it, the breakpoint remains associated with the component but is inactive.
You can’t add new breakpoints to a disabled component until it’s re-enabled.

Duplicate a Flow

To duplicate a flow, right-click the flow bar and select Duplicate Flow, or click the (Duplicate) icon in the Flow List.

The new flow is named [flow name] copy. You can change the name in the configuration panel.

Navigate to Referenced Flows

If a component references another flow (for example, via a Flow Reference connector), you can quickly access the target flow in the canvas by pressing Ctrl+Alt+g (Windows) or Cmd+Option+g (macOS).

Anypoint Code Builder opens the target flow either in the application canvas or the MUnit canvas, depending on the context. In the MUnit canvas, you can use Flow Reference components to invoke or simulate execution of other flows. To help you trace and validate the logic, navigate to the referenced flow from within the test by pressing Ctrl+Alt+g (Windows) or Cmd+Option+g (macOS).

Anypoint Code Builder opens the target flow in the application canvas (or in another MUnit test flow if that’s the target). Right-click a Flow Reference in the MUnit canvas to navigate to its target flow.

Import a Connector from Exchange

Test a Connection Configuration

Open a Component in the Canvas from the Code Editor

Connection Configuration Panel