Anypoint Studio Visual Editor
-
Drag and drop a connector from the palette onto your canvas.
-
Access the connector’s properties using the Studio UI. Click the plus sign next to the Connector Configuration dropdown.
-
You can add the credentials directly or store and reference them such as from the
mule-app.properties
file. For this example, in the .properties file we inputgithub.user=myuser
. Use the Ant syntax '${}' as shown in the configuration window. -
Click OK to close the configuration window.
-
-
Choose an operation for the connector to perform.
Alternatively, you can create the connector configuration by adding a Global Element first then reference it from the Connector Configuration dropdown:
-
Click the Global Element tab below the canvas in Anypoint Studio to create a global element where you define connector settings or properties.
-
Click Create, to define a new global element with the properties you require.
-
Add or reference the credentials through the UI and click OK.
-
The configuration you just created will show as available from the Connector Configuration dropdown.
-
XML Editor Approach
-
If you decide not to use Anypoint Studio or its user interface, add the desired connector configuration to your code in the XML editor. The visual representation generates in Studio after you properly:
-
Include the predefined namespace and schema location of the connector in the XML Configuration file’s header.
GitHub Connector Namespace and Schema Location Examplexmlns:github="http://www.mulesoft.org/schema/mule/github" ... xsi:schemaLocation=" ... http://www.mulesoft.org/schema/mule/github http://www.mulesoft.org/schema/mule/github/current/mule-github.xsd ">
-
Define the global connector configuration in your XML. It should look like:
<connectorname:config name="ConnectorName__Configuration" user="username" pass="password"… />
with all its required fields set inside the brackets. This line of XML code goes above the flow’s<flow>
XML block. -
Reference the configuration by specifying the global element’s
name
attribute in theconfig-ref
attribute of the connector. For example, the GitHub connector would use the global element called "GitHub__Configuration":<github:add-collaborator config-ref="GitHub__Configuration" doc:name="GitHub" owner="" repositoryName=""/>
-
Select an operation for the connector to perform.
-