- Artificial Intelligence
- Enterprise Portal
- Enterprise CMS
- Enterprise Integration
- Enterprise Processes
- Enterprise SOA
- Enterprise Cloud
- Internet of Things
- Mobile & Game Development
- Managed Cloud Services
- Personalized E-Commerce
- Robotics Process Automation
- Hire Resources
- Mule ESB
- Activiti BPM
- Amazon Web Services
- PHP Framework
- Mobile Development
- Angular JS
- Online Training
- Corporate Training
- Master Series
- Our Trainers
Custom Connector in Anypoint Platform
/ Friday, August 7th, 2015 / Published in Blogs
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
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)
How to use enum
public enum Type
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.
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”/>
Attune world Wide has been working with MuleSoft For Five years and Providing MuleSoft Development , Consulting and Training Globally.