Anypoint Connector DevKit
Anypoint™ Connector DevKit, or DevKit for short, is a Java development kit that integrates your Java code with Mule ESB. You can write custom Java code to extend Mule's out-of-the-box functionality, then use DevKit to easily integrate it with Mule, making it available for use by developers building Mule applications. Essentially, DevKit eliminates most of the hurdles and complexity involved in extending Mule's functionality.
DevKit greatly facilitates development of the two primary types of Mule extensions:
- Connectors, which extend Mule integration to SaaS services and on-premise applications not supported out of the box
- Modules, which provide core capabilities to Mule applications such as transforming, filtering, routing, or implementing custom business logic
Problem already solved!
Before digging into DevKit, take into account that there are already dozens of existing connectors built to integrate with Mule. Browse our library of community-built and company-built connectors to see if someone has already tackled the integration challenge you're facing.
This page, as well as the related pages in the Anypoint DevKit Guide, assumes you are familiar with Java annotations. For a brief overview of annotations, see the Java annotations tutorial.
Write Java code to define your custom extension.
Annotate your extension with predefined DevKit annotations
to generate code to integrate with Mule.
Generate an update site to make your extension
accessible and usable in Mule Studio.
DevKit enables you to concentrate on designing and building your custom Mule extension in Java without worrying about how it will integrate with Mule. Once you have developed your custom Java code – a connector or module – you can use DevKit's pre-defined set of annotations to reference the elements in your code that must integrate with Mule. DevKit processes these annotations to generate all the supporting code for integrating with Mule.
For example, when building a connector, you use the class-level
@Connector annotation to tell DevKit that it should export your POJO as a Mule Anypoint Connector. Likewise, you identify elements in your connector's code with the annotations that Mule uses for integration. These annotations handle all aspects needed for integration, such as connector operations, configuration fields, connection management, etc.
Additionally, you can use Maven to generate the project skeleton for your project, which contains the classes and libraries required for integration. With this method, you can generate a POJO class that has many of the requisite methods in place, already tagged with the required annotations (see example of a Maven-generate POJO below). You can then add your connection and authentication code, and your client code for calling out to the remote application. Finally, you implement and annotate the methods that define the application operations the connector will expose.
In short, Anypoint Connector DevKit allows you to focus almost exclusively on writing your custom extension, rather than constraining yourself with the considerations for integrating with Mule. Go ahead and build your extension – DevKit will generate most of the Mule integration code for you.
When to Build Your Own Connector
Not sure if DevKit is what you need? Listed below are a few benefits that might help you decide.
- DevKit provides the ability to write extensions to Mule without a deep understanding of how Mule works.
Using an Extension
After building your extension, you'll need a way to access the custom functionality in your instance of Mule. To ensure access to your custom extension in Mule Studio, use Maven to generate an Eclipse update site as part of the build. Then, import the extension just like you would any other in Studio project: Select Help, then Install New Software. (Refer to full extension installation details.)
Studio displays your new extension in the palette, just like any other building block. To see your extension's configuration parameters as displayed in Studio, drag and drop the extension to the Studio canvas, then double-click the building block to open its properties panel. All of your extensions' configurable items correspond to the parameters you annotated as configurable in your extension's source code. Refer to the image below which illustrates the mapping from annotation to configurable item in Studio.
This guide is not just a reference tool (though you'll find a description of all important interfaces), but a goal-oriented guide designed to provide the basic steps for building Mule extensions, specifically connectors. Each chapter covers a major part of building a connector, and all chapters are structured to reflect the order in which you should complete the action items.
This actionableguide is structured to represent the development process for building an extension. It helps you make decisions about functionality, and describes how to build, test and document your project. At each step, the guide provides the background information and basic concepts you need to make informed decision about how to proceed.
- Take the first step toward building your own Mule extension with the Anypoint Connector DevKit: Basic DevKit Concepts.