wso2/mi

1.1.0
Ballerina WSO2 Micro Integrator Module

Overview

The wso2/mi module provides the capability to generate modules that allow WSO2 Micro Integrator (MI) to run Ballerina transformations. This integration enables you to leverage the powerful transformation capabilities of Ballerina within the WSO2 Micro Integrator environment.

Unlike Class Mediators, Ballerina is a cloud-native programming language with built-in support for JSON and XML, making data transformations simpler. It also allows the use of available Ballerina language modules and connectors, enabling enhanced functionality and easier connectivity with external systems.

Compatibility

This module is compatible with Ballerina 2201.12.x and above, Java 21, and WSO2 MI 4.5.0+.

Supported data types

The following Ballerina data types are supported for function parameters and return types:

Data TypeParameterReturn Type
boolean✓✓
int✓✓
float✓✓
decimal✓✓
string✓✓
xml✓✓
json✓✓
record✓✓
map✓✓
array✓✓
any✗✓
()✗✓

Usage

Pull the migen tool

First, pull the migen tool which is used to create the WSO2 MI module:

Copy
bal tool pull migen

Import the module

Import the wso2/mi module in your Ballerina program:

Copy
import wso2/mi;

Write a Ballerina transformation

Write your Ballerina transformation using the @mi:Operation annotation:

Copy
import wso2/mi;

@mi:Operation
public function gpa(xml rawMarks, xml credits) returns xml {
    // Your logic to calculate the GPA
}

The Ballerina function annotated with @mi:Operation maps to an operation in the generated Ballerina module.

Generate the module

Use the bal migen module command to generate the WSO2 Micro Integrator module from your Ballerina project:

Copy
bal migen module -i <path_to_ballerina_project>

The command generates the module zip in the same location.

Using with WSO2 MI VS Code Extension

  1. Install the WSO2 Micro Integrator VS Code Extension
  2. Create a new integration project or open an existing project
  3. Add a Ballerina Module artifact
  4. Enter a name and version for the module
  5. Update the generated sample Ballerina code with your transformation logic
  6. Click the Build Ballerina Module icon to build the module

Once built, the Ballerina module will appear in the Mediator Palette and can be used in integration flows.

Import

import wso2/mi;Copy

Other versions

Metadata

Released date: 8 months ago

Version: 1.1.0

License: Apache-2.0


Security

No known vulnerabilities in libraries

Checked on 2026-11-15 via OSV.dev


Compatibility

Platform: java21

Ballerina version: 2201.12.0

GraalVM compatible: Yes


Pull count

Total: 0

Current verison: 1060


Weekly downloads


Source repository


Keywords

wso2-mi


Contributors