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:
-
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.
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.
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 one or more components into a new flow or subflow. This is useful for simplifying large flows or reusing logic.
To extract components:
-
Select one or more components in the canvas.
-
Right-click the selection and select Extract to Flow.
-
Enter a name for the new flow.
-
Select the target Mule configuration file.
-
Configure metadata preferences if needed.
-
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. |
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.
You can select multiple components by holding Shift and clicking components in the canvas.
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.
You can copy components and paste them in the same flow or in a different file or project.
To copy a component:
-
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.
-
Click Copy Component. Or press Ctrl+c (Windows) or Cmd+c (macOS).
-
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. |
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:
-
Right-click a component in the canvas.
-
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.
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.
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.
