Anypoint Connectors enable easy integration of MuleSoft applications with third-party APIs and standard integration protocols. They are used within application's flow to send and receive data via a protocol or specific API. Few basic connectors are already bundled with Anypoint Studio, and apart from these a large library of additional connectors are available for download from MuleSoft Connectors Library site. Most of the Connectors are available by default at no cost and few premium connectors are licensed. Anypoint Connector DevKit provided by MuleSoft enables to create custom connectors.
Advantages of custom connectors
A typical custom connector development life-cycle follows below procedure:
Setting Up a Connector Project
Pre-requisites – The following components have to be installed and should be working in local environment:
Writing Connector Code
1. Click on File -> New , then select Anypoint Connector project
2. Define the attributes as needed:
3. A default connector class will be generated after which the below annotations need to be configured.
The below screenshot shows a sample connector which will append “Hello” to the content . The required functionality can be defined for connecting to data base and also to any external API's, ERP Systems etc..
Generic Connector
4. Now the connector is ready with the functionality defined. Write the test cases for the connector.
Writing Connector Tests
1. Right click on the project in package explorer and click Anypoint Connector > Generate Tests
2. Next, click on the methods that is required to generate the tests and this can be changed as per requirement Writing the test cases are optional .
Documenting a Connector Project
Mule builds on Javadoc to automate and simplify the creation of technical reference documentation for the connector, adding a custom Javadoc doclet and some DevKit-specific Java annotations. This document describes on how the documentation can be generated and what needs to be included.
Packaging Your Connector for Release
When the connector is ready for release to a broad audience, some additional steps are necessary to be followed so as to ensure user success:
Create a license agreement for the connector.
Develop end-to-end walkthroughs to illustrate performing common use cases with the connector
1. Now, the connector can be built by going to the command line and run the following command:
$ cd custom-connector
$ mvn package -Ddevkit.studio.package.skip=false
2. Now, the project from Anypoint studio needs to be imported and then the connector from Mule studio
3. Type the connector name in the search box.
4. Drag and drop the connector ,add the required parameters .Select the desired operation as required.
References
If you would like to find out more about how Systems Integration could help you make the most out of your current infrastructure while enabling you to open your digital horizons, do give us a call at +44 (0)203 475 7980 or email us at Salesforce@coforge.com
Other useful links:
Integration with LinkedIn using Mule ESB
Integration of Mule ESB with Microsoft Azure
Integration with Dropbox using Mule ESB
Integration with Twitter using Mule ESB