Contact Us
A 101-103 Siddhivinayak Towers, Off S.G. Highway, Ahmedabad, Gujarat 380051

Custom Connector in Anypoint Platform

by Attune World Wide / /
MuleSoft provide another extension module that is custom connector in Anypoint Platform. And It provides the facility to connect with third party APIs. 
Using custom connector we can interact with third party API. We can perform operations such as Insert record, update record etc..
Custom connector is reusable component.
How to use it?
First we must have maven installed to our system.
Then, Go to Help menu in Anypoint Studio click on Install New Software. Then after copy this url  http://studio.mulesoft.org/r4/addons/beta  and paste it to the Work with drop down. Click on next and accept the terms and condition and click on finish. Then Restart the Anypoint studio.
After installing the plugin create Anypointer Connector Project. Go to File Menu -> New -> Anypoint Connector.
Give Project Name and choose Type Java SDK and click on finish
Functionality of Connector
Once project is created then default connector class will be generated. We have to define annotation in connector class
Following annotations are used
@Connector : It define name of the connector
@Configurable: It define property of the connector.
For ex: If I define
@Configurable
@Default(“value”)
 private String myProperty;
Then myProperty is required for my connector. I must have define myProperty
@Processor : Using Processor annotation we can define operation.
@ValidateConnection: This annotation  is used to check whether connector is actually connected or not. It will check the connection status
@Payload : It will receive the data (payload)
public String setData(@Payload String data)
Example:
How to use enum 
     public enum Type
    {
    Json,
    Xml;
    }
    @Processor
    @Default(“Json”)
    public String report(Type MimeType)
    {
    }
Basically in annotation @Default, @Optional are widely used. When you define @Optional that means the field is not required. When you define @Default it will automatically take that value.
We can not use combination of @Optional and @InboundHeader annotation
If you define enum type in connector operation, It will open as selection box.
How to generate Connector
To used Operation (Processor), we must have to generate the connector.
For generating the connector right click on project choose Anypoint Connector -> Install or Update then it will start download steps.
Once finish this step restart the Anypoint studio. In pallet you can search your connector name
We can also generate connector through command line.
cd custom-connector-name
mvn package -Ddevkit.studio.package.skip=false
Now, import this project to Anypoint Studio.
Go to Help menu -> Install New Software Now click on Add button and give your full path of your package for ex: “file:/(your path)”.
Now, Select the connector to the update sites and follow the download steps then restart Anypoint Studio
Connector in config file
<connector-test:report config-ref=”ConnectorTest__Configuration_type_strategy” AccessSecret=”*********” AccessToken=”*****” CompanyId=”****” ConsumerKey=”*****” ConsumerSecret=”******” MimeType=”Json” doc:name=”ConnectorTest”/>

About Us: 

We Are A Certified Mulesoft Team

Attune world Wide has been working with MuleSoft For Five years and Providing MuleSoft Development ,  Consulting and Training Globally.

We Are here To Help You , Let Us Know

About Attune World Wide

What you can read next

Leave a Reply

Your email address will not be published. Required fields are marked *

seventeen + 1 =

Recent Posts

X