Introduction to Mulesoft Connectors [Explained with examples]


In this article, we will see the introduction of Mulesoft connectors and will try to get the answer of some of the important questions like what is Mule connector, how to configure it , how and where to use some of the basic connectors, how to import additional mule connectors from Exchange to Mule palette etc. MuleSoft is the one stop solution for all integration operations. It offers API Design, mock develop run test deploy on single platform mule meets rigorous performance, scalability, security and feedback every phase of API development. You can check all the available Mule Connectors list on official documentation.


Before going to the topic, let's discus the prerequisites required for the MuleSoft development:-

  • You should have a valid Anypoint platform account in
  • You should have a valid subscription.
  • You should have Latest Anypoint Studio IDE installed in your System.
  • You should have basic idea in Java and web services development.

Introduction to Mulesoft Connectors [Explained with examples]

Introduction to Mulesoft Connectors [Explained with examples]

Also Read: Easy Steps to Install Java on Ubuntu 20.04

In the Anypoint platform, Connectors plays a vital role. So the first important question is what is a Connector ? A connector is a set of instructions to perform an operation to interact or integrate with the particular system or application or with an API without coding ourselves. That set of code or instructions is the graphical representation is called a Mule connector in MuleSoft. In simple words, Mule connector means “ready-made integration logic”.


What is the use of Mule connectors 

Connectors are reusable components in MuleSoft. Mule Connectors are used to integrate with any third-party system. Here any means anything you can connect through Mule Connectors, that is the beauty of the MuleSoft Connectors. Mulesoft has provided the privilege to Developers and architects to do whatever they want in integration, you can connect any system, application or API using Mule Connector. It makes Mulesoft developer life easier.


Some Mulesoft Connectors

  • HTTP Connectors
  • Intercom Connectors
  • Salesforce Connectors
  • Amazon S3 Connectors
  • Anypoint MQ Connectors
  • Gmail Connectors
  • FTP Connectors
  • Jira Connectors
  • MongoDB Connectors
  • Database Connectors
  • Google Drive Connectors
  • Workday Connectors
  • Zoom Connectors , and so on.


Overview of Anypoint Studio platform

Let's open a new Project and see the different parts of Anypoint Studio platform.

Introduction to Mulesoft Connectors [Explained with examples] 2

The main component includes:-

  • Canvas: Drag and drop building blocks here to create a message flow.
  • Palette: Filter and select building blocks from here.
  • Console: Feedback about your app when deploying.
  • Properties Editor: Configure attributes of the selected building block.
  • Package Explorer: View your project structure.


How to use Mule Connectors 

a) Drag and drop any of the selected Mule Connector from Mule Palette. It will automatically generate the mule flow and place the Mule connector inside of the flow as shown below.

Introduction to Mulesoft Connectors [Explained with examples] 3

b) Search “Scheduler” in mule palette and then drag the connector and drop in Canvas. You will see flow gets generated automatically and the Scheduler placed inside of the flow in source place.

c) Below snippet shows the best example of Mule Connector. Scheduler is a Mule Connector which perform a specific task related to time operations. Here we can observe that scheduler connector triggers the flow based on Scheduling strategy - either with a specific Fixed Frequency of time or with Cron expression configuration.

Case 1: In Fixed Frequency, in every 1000 milliseconds, scheduler fire at every 1 sec.

Introduction to Mulesoft Connectors [Explained with examples] 4

Case 2: In Cron, as per the given expression (0 0 12 * * ?), scheduler fire at 12:00 PM (noon) every day on Asia/Kolkata time zone.

Introduction to Mulesoft Connectors [Explained with examples] 5


Example of Mule Connector

a) Using Http Listener Connector : The HTTP Listener can initiate the flow when it receives the signal or request from REST client. You can choose different methods to perform different actions for different situations as per the carried Mule Event. The http listener receives the data in four ways:-

  • Header
  • quarryParams
  • uriParams
  • Body

b) HTTP Listener configuration: Once you drag and drop the Http Listener Connector in Message Flow, it will be placed inside the Flow and automatically open the Mule Connector properties under the Property Window. You need to then update the values of each required property and configure the connection configuration by choosing the + (add) sign or in Canvas, Global Elements ->Create->choose Http listener config and fill below property values:-

  • Host
  • Port
  • Read timeout and
  • Base path

Update values and then test the connection. After successfully testing the connection, click on ok button and then in properties window update the path forward slash ( / ).

Introduction to Mulesoft Connectors [Explained with examples] 6


Features of Mule Connectors

  • Simple development : The Mule Connectors are developed under Java. It was developed keeping simplicity in mind.
  • Flexibility: It provides us an easy way to achieve our targets without compromise in flexibility.
  • Security: The Mule Connectors are highly secured. Each Connector implements all modern security protocols, secure algorithms, TSL/SSL, and SSH ciphers.
  • Establishing connection: Accessing the target system is also very simple. You just need few clicks to establish connection in any system in a secure way.
  • Programming: We don’t need to know the programming of target system. Just some basics are required to enable the connection.


Types of Mule Connectors

Mule Connectors are can be broadly divided into two types:-

a) End point-based Connectors: This Connector is either a one-way (request) or request-response (two-way) and it's based on the requirement of communication of protocol. These Connectors are intended to be used to initiate or trigger the flow. Example includes SMTP, SFTP etc.

b) Operation-based (process level) Connectors: These operation-based Connectors are used in the process level and it is used to perform a specific method of operation. Each operation has a separate Connector. Example includes Database Connectors, Salesforce Connectors etc.


Where to find Mule Connectors 

Anypoint platform has a central repository for Mule Connectors which is called Anypoint Exchange. In Exchange, we can find all types of Mule Connectors. Most of the them are predefined. If you did not find your desired connector in predefined, you can build and customize by using Anypoint Connector devkit and Anypoint Studio. You can build your connector as per your requirement and then publish that customized Connectors in Exchange. You can select publish option to publish your custom mule Connectors either in public or within the organization if it's a private publish.


How to Add Mule Connectors to Anypoint Studio 

In Anypoint Studio, create a Project on the right side window. In the Mule Palette below the search box in left side panel, find the “search in Exchange button” and click on it to navigate to Add Dependencies to Project. Here sign in using Anypoint platform username and password(if you are in first time).

In the same window, search all the required Connector name in search box and you will see list of Connectors displayed on the left side of the pane. Select any of the available modules and then add it. It will be then displayed in Selected modules. Now you will see those selected modules will be available in Local Anypoint Studio. Below is the example to add one such connector:-

  • Import the Amazon S3 Mule Connector from Anypoint Exchange to local Anypoint Studio Mule Palette as shown below.

Introduction to Mulesoft Connectors [Explained with examples] 7

  • After finishing the above step successfully, you can see Mule Palette amazon S3 components as shown below.

Introduction to Mulesoft Connectors [Explained with examples] 8


Mule Connector Configuration

Before we use Connectors must configure them. otherwise, it won’t work. we must aware of the Connector  configuration before we proceed with it. Each and every Mule Connector has a specific requirement of configuration the Mule Connectors can configuration in three ways.

a) Anypoint studio Global Configuration Elements

Here we will see an example of Http Listener configuration. In the Global Elements tab ->Create -> Choose Http listener config and then fill below property values :-

  • Host
  • Port
  • Read timeout
  • Base path

Introduction to Mulesoft Connectors [Explained with examples] 9

Update and then test the connection. After successfully tested, click on ok button and then in properties window, update the Path forward slash ( / ).

b) Anypoint Studio HTTP Listener Configuration in XML

XML Code for the Mule HTTP Listener Connector Configuration are as follow:-

           doc:name="HTTP Listener config"
           <http:listener-connection host="" port="8081" />

c) Flow designer in Anypoint Design Center

In Design Center, the Mule Project will be deployed in Cloud-Hub. The Http Listener configuration takes two steps as described below:-

Step 1: Select the Connector and choose the operation of the connector here. Search HTTP Connector in Trigger and then select Listener Operation as shown below.

Introduction to Mulesoft Connectors [Explained with examples] 10

Step 2: In this step we only need to configure the path and the rest will be automatically configured itself by Anypoint Design Center. If you want to customize then you will also have the option to configure customize values.

Introduction to Mulesoft Connectors [Explained with examples] 11


Best Practices in Mule Connector Configuration

a) Use separate configuration files for the global configuration of elements.

b) Use the reconnection strategy to set the number of reconnection attempts after the connection with the initial flow(This property is placed in the Advanced tab).

c) Each and every time after updating the configuration values, you must test the connection before deployment.

d) Use property files to store and secure the property values outside the Anypoint Studio editor. Go to Package Explorer window and expand your project folder contents. Right click on 'src/main/resource' folder and select New-> New File->"" or "properties.yaml". Both formats are accepted in Mule 4 version.

Introduction to Mulesoft Connectors [Explained with examples] 12

It should appear in the project folder like below.

Introduction to Mulesoft Connectors [Explained with examples] 13

Then update the property values of used Connectors in the project as shown below.


Introduction to Mulesoft Connectors [Explained with examples] 14


Please note the single space given above after colon.

Introduction to Mulesoft Connectors [Explained with examples] 15


Please note that there is no space before or after equals to(=) sign in the above configuration file.


Property place holder

Http listener configurations property values in property place holders are as follows:-

         basePath="${http./service }">

After updating the property file, we must configure that into Global configuration elements in configuration properties file which is configured with either .yaml or .properties file as shown below.

Introduction to Mulesoft Connectors [Explained with examples] 16

Leave a Comment