Like the existing mule, connectors are grouped into different modules such as Salesforce, HTTP, Validation, Core, etc. Mule 4 allows us to define custom modules using Java SDK & XML SDK. Each mule connector defines a particular process, set of input parameters & output as a result.
Module defines a set of operations that we call connectors in mule; to access through mule XML configuration files. Creating a data weave module instead of explaining it in the XML configuration file allows us to access it through data weave code.
Once created, custom modules work like any other mule modules in any other mule applications across the organization.
XML SDK Vs. Java SDK
SDK stands for “software development kit,”; whereas mule SDK has two parts XML SDK and Java SDK. Extending the mule runtime allows the parts, as mentioned earlier, to be created.
- This approach is like the classic flow definition through any point studio.
- We can use Java SDK to create source components and XML SDK to create operation/process components.
- Recommended using XML SDK unless it is crucial to use the features of Java SDK because XML SDK is easier to develop.
- Once decided which SDK to use for creating modules, another critical factor is determining the SDK version compatible with the mule runtime version. By choosing the lowest possible SDK version, it maximizes the compatibility with different mule runtime versions.
Make sure to consider the below pointers if you need to choose between XML SDK or Java SDK.
- As mule developers are already familiar with XML syntax while defining flows, it becomes easier to understand.
- Still, it lacks clarity because we should be aware of the expected input parameters & data types in advance. We usually define a flow or sub-flow to implement the logic in mule. But for different applications, this flow or sub-flow must be exported as a jar file and then imported into the target flow reference among projects.
- Encapsulating that flow into an operation clearly defines input & output parameters. So, we can implement custom modules to achieve the same.
- To create a source component, a scope, or an operation, we can define Java SDK.
- Java SDK gives a lot of features & control over the module that developed.
Mule extension API
It defines how mule modules can interact with mule runtime. Development of all these custom modules in mule happens on top of “mule extensions API.” Both SDKs are built-in with the abstraction layer over this extension’s API. So, developers don’t have to bother about how custom modules interact with extensions API.
Mule SDK allows developers to define custom modules made up of Java SDK or XML SDK. Before implementing a custom module, we should decide which SDK to use & which version to operate. These decisions are highly dependent on the specific use case.