Anypoint Connector Development

Author: Sneha Veeranki

Anypoint Connectors are reusable extensions to the Mule runtime engine (Mule) that enable you to integrate a Mule app with third-party APIs, databases, and standard integration protocols. Connectors abstract the technical details involved with connecting to a target system. All connectivity in Mule 4 is provided through connectors.

Here, we’re have developed a basic and simple mule 4 connector which gives an output “Hello World”. We’ll learn, 

  • What are the prerequisites and how to set-up the system?
  • How to create an SDK for Connector development in mule 4.
  • How to set-up the basic configurations
  • How to run the maven command in cmd to create the basic architecture for the connector.
  • How to add the dependency to the pom file.
  • Where to find the connector and how to use it.
  1. Prerequisites:
  2. Java Development Kit 8 (JDK 8)
  3. Apache Maven, version 3.3.9 or higher
  4. Intellij IDEA 
  1. Set the system variables:
  2. Path 

> Open the cmd and run a maven command –

mvn org.mule.extensions:mule-extensions-archetype-maven-plugin:1.2.0:generate

> Running this command provides the basic structure to develop the connector.

  • Can set the name, groupId, artifactId, version and main packagefor the extension or leave it for default 

> A project is created named “mule-basic-extension”, open the project in the IntelliJ 

> There is a dependency that should add to the mule application pom.xml.

> To run this project navigate tofile > settings > Build, Execution, Deployment > Compiler> Java compiler and Add -parametersin the Additional command line parameterssection.

> In Terminal run mvn clean install 

> Once the build is successful, copy the dependency from 

How to Use the Connector in Anypoint Studio: 

> Create a new mule project in Anypoint studio.

> Open the pom.xml, add the dependency within the dependencies and save the file.

> In project explorer can find the libraries:

> Navigate to the mule configuration file, drag an HTTP listener and configure.

> Find the Basic connector in the Mule Palette, drag Say hi and place it after the listener and enter a “Hello World!!!”. 

> Save the application and run it, once it is deployed.

> Open the Postman or ARC and send a request to http://localhost:8081/sayHi

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.