Migrating Devkit Connectors to Mule 4 SDK

  • Written By WHISHWORKS
  • 12/04/2018

Mule is a lightweight integration runtime engine that powers Mule applications. Mule applications receive events, process them and route them to other endpoints, and Mule Runtime defines the rules on how event data is handled in each application.

The role of Connectors is to facilitate the integration of Mule applications with third-party APIs and standard integration protocols. These are the elements which receive or send messages between Mule and an external source.

MuleSoft already has more than 160 free, off-the-shelf connectors for some of the most frequently used integrations, along with a set of premium connectors like SAP, SalesForce, Siebel etc. These connectors will be migrated for Mule 4 by the companies that originally developed them, such as WHISHWORKS.

For all other systems, often users develop their own custom connectors to enable their integration with Mule and this is where an understanding of how to migrate to the new Mule 4 environment will be needed.

Mule 3 Devkit vs Mule 4 SDK

Up to now, to develop these custom connectors users would use the Anypoint Connector DevKit (DevKit), which is available for Mule 3.x Anypoint Studio as a plugin. DevKit is an annotations-based tool, with a wide set of available annotations to support its features. It also includes connector packaging tools.

Mule 4 uses Mule SDK to create custom connectors. Unlike Devkit, Mule SDK is not a code generator. It is rather a plain extension mechanism. Mule SDK also adds support for features like Transactions, Request-Response message sources, Dynamic configurations, Routers, Non-Blocking operations, Classloading isolation etc.

In Mule 4, Studio 7.x comes with Mule SDK already installed, however it only supports Mule 4.x connectors (and projects in general), because the structure of the project, export format, xml and scripting language are different from Mule 3.x.

Users must migrate Mule 3.x connectors to Mule 4.x manually, before they can be used in Studio 7.x.

How to migrate a Devkit Connector to Mule SDK:

A Mule 4 upgrade should be approached as a migration project. To migrate an existing Devkit Connector in order to be compatible with Mule 4 SDK, the changes below, at high level, need to be incorporated into the connector code base.Update pom file, to enable the Connector as Mule 4 extension

  • Update Packaging element


  • Update parent element

</parent>Folder structure

The typical folder structure for Mule 4 Connector will be:

  • <Module>/api
  • <Module>/internal

Update Annotations and Params Classes

Remove/Add/Replace Classes w.r.t Mule 4 SDK

Mule 3.x ClassesActionMule 4 Replacements
org.mule.api.annotations.ConfigREPLACE org.mule.runtime.extension.api.annotation.param.Config
org.mule.api.annotations.ConnectorREPLACE org.mule.runtime.extension.api.annotation.Extension
org.mule.api.annotations.param.DefaultREPLACEAttribute(defaultValue) of Optional
@Optional(defaultValue =
@RefOnlyREPLACE@ExpressionSupport(NOT_SUPPORTED) and
@org.mule.api.annotations.TestConnectivity  REMOVE 

Organise import statements (Remove old APIs and/or Add new APIs)

  • Remove All classes within Package org.mule.api

Refactor Class(es) into multiple classes as per basic model structure of Mule 4 SDK

  • Add *Extension class with below annotation at class level:

@Extension(name = “azure-storage”)


@RequiresEnterpriseLicense(allowEvaluationLicense = true)

  • Add below annotation for the processor methods

@MediaType(value = ANY, strict = false)

Unit Tests

  • Override getConfigFile() method to load the operation flow
  • Test Class Extends MuleArtifactFunctionalTestCase
  • Test Class name should be *Test*.java

Dependency software and versions:

Mule runtime | 4.1.0
Mule SDK | 1.0.0
Java | 1.8
AnyPoint Studio | 7.1.0
Maven | >3.3.9

If you would like to find out more about Mule 4 and how you can migrate your connectors and projects to the new version of MuleSoft’s Anypoint Platform, do give us a call at +44 (0)203 475 7980 or email us at marketing@whishworks.com

Other useful links:

Mule 4 and Studio 7 – a bird’s-eye view of what’s new

API Recipes with MuleSoft Anypoint Platform

MuleSoft Integration Services

Latest Insights

MuleSoft Composer

APIs at the fingertips of Salesforce users

MuleSoft Composer enables Salesforce users to develop ‘light weight’ integrations quickly with just a few clicks.

Salesforce Classic to Lightning migration

Salesforce Classic to Lightning migration – things to consider

Things to consider when migrating from Salesforce Classic to Lightning so that potential challenges are mitigated, resolved, or avoided.

Salesforce health cloud - healthcare

Healthcare in the Cloud

Salesforce Health Cloud is designed to improve patient satisfaction, deliver high-quality patient care, and deliver positive outcomes.