Contact Us 1-800-596-4880

Using Anypoint Studio to Configure a Connector

To use Anypoint Studio to configure a connector:

  1. Supply your authentication credentials to Anypoint Platform.

  2. Install the connector.

  3. Configure a source for the connector’s flow.

  4. Configure the connector.

Follow these best practices when you configure a source and connector in Studio:

  • Configure an associated global element for the source and connector.

  • Create a YAML file or properties file to contain your properties, and then reference the file from the configuration.

  • Configure a reconnection strategy for the source and target connector.

For information about these best practices, see Best Practices for Configuring Connectors.

Supply Authentication Credentials to the Anypoint Platform

To access connectors on the Anypoint Exchange portal, you must first configure Anypoint Platform credentials if these have not been configured:

Add the Connector to Your Mule Project

Installing a connector adds it to a Mule project:

  1. In Studio, create a Mule project.

  2. In the Mule Palette view, click (X) Search in Exchange.

  3. In Add Dependencies to Project, enter the connector name in the search field.

  4. Click the connector name in Available modules.

  5. Click Add.

  6. Click Finish.

Configure a Source for the Connector

A source initiates a flow when a specified condition is met. Configure a source for the connector’s flow, such as an HTTP Listener operation (HTTP Listener), Scheduler endpoint (Scheduler), or connector-specific source.

Use HTTP Listener as a Source

HTTP Listener listens for HTTP requests and triggers the associated flow when it receives them. To use HTTP Listener as a source:

  1. In the Mule Palette view, search for HTTP and select the Listener operation:

    Select HTTP Listener to listen for HTTP requests

    image"::intro-config-studio-select-listener.png["Selecting HTTP Listener as a source"]

  2. Drag the Listener operation onto the canvas.

  3. In the Listener configuration screen, click the plus sign (+) next to the Connector configuration field to add a global element for HTTP Listener.

    The following screenshot shows the default values on the General tab for the HTTP Listener global element:

    HTTP Listener global element default values
    Figure 1. Default values for the HTTP Listener global element
    • The first section shows the default values for the protocol, host, and port to use in the connection.

    • The second section shows the default values for the base path and listener interceptors to use in the connection.

  4. Accept the defaults on the General tab or specify required information:

    • To listen on a specific port for every network interface on the server, leave the default value 0.0.0.0 for the Host property.

    • To listen for incoming requests generated inside the server, set the Port value to localhost.

  5. To use TLS, click the TLS tab and specify the required information.

  6. On the Advanced tab, specify a reconnection strategy. For information, see Anypoint Connector Configuration.

  7. Click Test Connection to confirm that Mule can connect with the specified server.

  8. Click OK.

  9. Set the Path field to the appropriate path.

  10. Select the other tabs and specify the appropriate field values.

For more information about HTTP Listener, see the HTTP Connector Reference.

Use Scheduler as a Source

Use Scheduler to initiate a flow when a time-based condition is met. You can configure Scheduler to initiate a flow at a regular interval or you can use a more flexible cron expression. For example, you can use Scheduler to initiate a flow every five seconds, or you can set up a cron expression to initiate a flow at noon every day for one month.

To use Scheduler as a source:

  1. In the Mule Palette view, search for and select Scheduler:

    Selecting Scheduler as a source
    Figure 2. Select Scheduler to schedule when a flow is initiated
  2. Drag Scheduler onto the canvas.

    The following screenshot shows the default values for the scheduling strategy:

    Default values for the scheduling strategy
    Figure 3. Default values for the scheduling strategy
  3. In the Scheduling Strategy field of the Scheduler configuration screen, select whether you want to use a fixed frequency or cron expression to initiate the flow:

    • If you select Fixed Frequency, enter values for these fields:

      • Frequency

        The frequency at which the Scheduler initiates the flow, based on the time unit specified in the Time unit field

      • Start delay

        The amount of time to wait before initiating the flow for the first time after the app starts, based on the time unit specified in the Time unit field

      • Time unit

        The time unit for the values of Frequency and Start Delay

    • If you select Cron, enter the cron expression in the Expression field and the time zone in the Time Zone field.

      For the format and valid values for the Time Zone field, see the Javadoc for the Java TimeZone class.

  4. To configure metadata for the payload, variables, and attributes, select the Metadata tab and add the appropriate metadata.

For more information about Scheduler, see Scheduler Endpoint.

Use a Connector-Specific Source

If a connector has associated sources, you can use a connector-specific source to initiate the flow. Each connector source has a unique configuration.

For example, you can use Amazon SQS Receive Messages as a source for Amazon SQS Connector. This source initiates a flow each time the specified Amazon SQS queue receives a new message.

To configure a connector-specific source:

  1. In the Mule Palette view, search for the connector and select the source.

    For example, search for Amazon SQS and select the Receive Messages source:

    Amazon SQS Receive Messages source
    Figure 4. Searching for the Amazon SQS Receive Messages source
  2. Drag the source onto the canvas.

  3. In the configuration screen, click the plus sign (+) next to the Connector configuration field to add a global element for the source.

  4. Enter values for the required fields.

  5. On the Advanced tab for the global element, specify a reconnection strategy. For information, see Anypoint Connector Configuration.

  6. Click Test Connection to confirm that Mule can connect with the specified server.

  7. Click OK.

Configure the Connector

To configure a connector in your Mule app, first configure a global element that can be used by all instances of that connector in the flow:

  1. In the Mule Palette view, search for the connector and select the desired operation.

  2. Drag the operation onto the canvas to the right of the source.

  3. In the configuration screen for the operation, click the plus sign (+) next to the Connector configuration field to add a global element for connector.

  4. Specify the global element properties for the connector.

  5. On the Advanced tab in the global element properties, specify a reconnection strategy, if supported. For information, see Anypoint Connector Configuration and the reference guide for the connector.

  6. Click Test Connection to confirm that Mule can connect with the specified server.

  7. Click OK.

After you configure a global element, configure the other fields for the connector.

For information about configuring a specific connector, see the user guide and reference guide for that connector.