Configuring Components
Configure connectors and processors within your implementation and integration projects from the canvas or configuration XML.
Common tasks include the following:
Before You Begin
-
Determine which connectors, processors, and snippets you intend to use.
When adding components, you can start from code snippets, the canvas, or the configuration XML for your app. You can configure components from their configuration panels in the canvas or from the XML. For reference documentation on specific connector and component configurations, see Reference.
-
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
The following example illustrates basic configurations for adding components to your project from the canvas, and the configuration XML. The example assumes you are beginning with an empty integration project.
-
In the Explorer, open the configuration XML file for your project:, such as
my-project-name.xml
.1 The canvas provides space for a visual representation of your Mule flows or subflows. 2 The configuration XML editor displays the configuration file for your Mule application. -
Select Build a Flow from the canvas to create an empty flow within a Mule integration application.
-
Change the default name of the flow from the canvas or from the configuration XML.
-
From the canvas
-
From the configuration XML
Click Flow name1 to open the configuration panel for the Flow component, change the flow name, and click the check mark to set the new name.
Replace the default name of the flow (
name1
) with your flow name, such asgetFlights
, for example:<flow name="my-flow" > </flow>
-
-
Add a component to your project from the canvas.
For example, add the HTTP Listener component:
-
In the canvas, click the (Add component) icon.
-
In the Add Component panel, search for and select Listener from the HTTP results:
The configuration XML file now includes the XML for the HTTP Listener within the
<flow/>
element, for example:<flow name="getFlights" > <http:listener path="mypath" config-ref="config-ref" doc:name="Listener" doc:id="rrjiqa" /> </flow>
-
-
Add another component, this time using the XML configuration menu.
For example, add the
<http:listener-config/>
component from a snippet.For more information about snippets, see Working with Code Snippets.
-
In the configuration XML, place your cursor before the opening
<flow>
tag, and typehttp
.Ensure that the cursor is not inside the
<flow/>
element. -
Type
http
, and select thehttp:listener-config
snippet:The snippet adds the following code:
<http:listener-config name="HTTP_Listener_config" > <http:listener-connection host="0.0.0.0" port="8081" /> </http:listener-config>
-
Notice that the Listener component in the canvas now displays an error:
-
To determine where the error is, select the processor in the canvas.
Anypoint Code Builder highlights its location within the configuration XML, and you can mouse over the issue for more information, for example:
-
To fix the error, change the value of the
name
attribute inhttp:listener-config
to match the name of theconfig-ref
value in yourhttp:listener
configuration:<http:listener-config name="config-ref" > <http:listener-connection host="0.0.0.0" port="8081" /> </http:listener-config>
The HTTP listener within your flow now references the HTTP listener configuration, a global connection configuration that resides outside of the flow. For more information about debugging, see Debugging Mule Applications.
-
-
Add another component to your flow.
For example, add a Set Payload component to your HTTP Listener operation:
-
In the canvas, click the (Add component) icon.
-
In the Add Component panel, search for and select Set payload from the Transformer results.
-
In the canvas, click Set payload to open its configuration panel, and add a string value, DataWeave expression, Mule variable, or configuration property.
-
To add a string, type a value such as
my value
. For example: -
To add a DataWeave expression or a Mule variable as a value, such as
payload
, click fx (located before the field), and provide the value, for example:For more information about configuring DataWeave expressions, see Configuring DataWeave Expressions.
-
To add a configuration property as a value, type a value such as
${secure::mysensitiveprop}
. For example:For more information about configuration properties, see Defining and Securing Properties for a Mule Application.
-
-
Your configuration XML file now looks similar to the following:
<http:listener-config name="config-ref" >
<http:listener-connection host="0.0.0.0" port="8081" />
</http:listener-config>
<flow name="getFlights" >
<http:listener path="path" config-ref="config-ref" doc:name="Listener" doc:id="rrjiqa" />
<set-payload value="my value" doc:name="Set payload" doc:id="gecykt" />
</flow>
Import a Connector from Exchange
Anypoint Connectors provide operations for retrieving, modifying, and sending data to and from systems. In addition to the built-in connectors that Anypoint Code Builder provides, you can download many other connectors from Anypoint Exchange.
Import a Connector from the Canvas
To import a connector from Exchange and add it to your configuration:
-
In the Explorer, open the configuration XML file for your project:, such as
my-project-name.xml
. -
Click (Show Mule graphical mode) in the activity bar to open the UI canvas if it doesn’t open automatically.
-
Add the connector the same way you added other components from the canvas:
-
In the canvas, click the (Add component) icon.
-
In the Add Component panel, click Connectors.
-
Click the connector name and then click the operation to add, such as Publish:
-
If the connector is not available locally, click the (Search in Exchange) toggle:
1 Search locally 2 Search in Exchange -
Select the connector to add to your project.
-
Select the operation from the Add Component panel.
-
Import a Connector with a Command
To import a connector from Exchange to use later in your project:
-
In the Explorer, open the configuration XML file for your project:, such as
my-project-name.xml
. -
Click (Show Mule graphical mode) in the activity bar to open the canvas if it doesn’t open automatically.
-
Open the Command Palette.
Show me how
-
Use the keyboard shortcuts:
-
Mac: Cmd+Shift+p
-
Windows: Ctrl+Shift+p
-
-
In the desktop IDE, select View > Command Palette.
-
In the cloud IDE, click the (menu) icon, and select View > Command Palette.
-
-
Select the following command:
MuleSoft: Import Asset from Exchange
-
Select Connector.
-
Search for the connector name to import, such as "MQ," for example:
-
Select the connector.
-
At the prompt, select the version of the connector to import, such as
v4.0.3
.Anypoint Code Builder imports the connector and makes it available in the Components list.
For more information about the connectors available on Exchange, see Connectors. For more information about Exchange, see Exchange (US) or Exchange (EU) and Anypoint Exchange Overview.
Test a Connection Configuration
Most connectors provide an operation, such as the HTTP Listener operation, that triggers the flow to start. These operations typically include connection configurations that you can test.
Test Connection from the Configuration Panel
You can test the connection from the connectors Configuration panel. For example, to test an HTTP Listener connection:
1 | Click the + icon on the connector to open the configuration panel. |
2 | After filling in the required fields, click Test Connection. |
The status bar shows the progress:
-
Verifying connection indicates that the test is in progress.
-
Connection is valid indicates a successful connection.
-
Invalid Connection Got status code: 500 when trying to resolve a Mule Runtime operation indicates a connection error.
Test Connection from the Configuration XML
You can test the connection from the configuration XML. For example, to test an HTTP Listener connection, click Test Connection in the configuration XML:
The status bar shows the progress:
-
Verifying connection inbound-request indicates that the test is in progress.
-
Connection is valid indicates a successful connection.
-
Invalid Connection Got status code: 500 when trying to resolve a Mule Runtime operation indicates a connection error.
A common code
500
error isport 8081: Address already in use
. For port conflicts, configure a different port, such as8082
, and retest the connection.
Before publishing, run your application in debug mode.
Open a Component in the Canvas from the XML Editor
You can open a component and its configuration panel in the canvas from the XML editor. This feature is helpful, for example, if you want to configure the component from the UI, if a component is in another flow than the flow currently displayed in the canvas, or if the canvas is not open.
-
From the configuration XML, place your cursor within the component’s XML.
-
Right-click and select Configure Component in UI.
This action displays the component in the canvas and opens its configuration panel, for example:
Connection Configuration Panel
Use the Connection Management Configuration Panel to easily configure connections to third-party systems directly from the UI.
In this panel, you can create, edit, delete, and test connections directly within the ACB interface, automatically populate connection fields using metadata provided by the connector, and save and manage connection configurations without switching to the XML view.
To open the configuration panel:
-
Click on an existing component, or add a new one.
-
Click the + icon.
This action displays the configuration panel, for example:
From here, you can:
-
Configure a connection for this project.
You can select a previously saved connection in the Connection field and the form is pre-populated with existing configuration data.
Changes impact all components using this connection. -
Update connection details without manually editing the XML code.
-
Test the connection directly within the panel to verify it’s correctly configured.
The test functionality helps prevent errors by allowing users to confirm that the connection is valid before committing changes.
-
Delete an existing connection if it’s no longer needed.
A confirmation message shows any affected components that use the connection.
-
View all components that depend on a connection.