The mi-module-gen tools allows generation of modules for WSO2 Micro Integrator from Ballerina code.
Version compatibility:
| Tool version | wso2/mi Connector version |
Ballerina Version | Java version | WSO2 MI version |
|---|---|---|---|---|
| 0.2 | 0.2 | 2201.10.3 | 17 | 4.2.0, 4.3.0 |
| >= 0.3 | 0.3 | 2201.12.7 | 21 | 4.4.0 |
First, you need to pull the mi-module-gen tool which is used to create the module.
$ bal tool pull mi-module-genCreate a new Ballerina project or use an existing one and write your transformation logic. Import the module wso2/mi in your Ballerina program.
import wso2/mi;Write Ballerina Transformation. For example,
import wso2/mi;
@mi:Operation
public function GPA(xml rawMarks, xml credits) returns xml {
// Your logic to calculate the GPA
}Ballerina function that contains @mi:Operation annotation maps with a component in Ballerina module.
Finally, use the bal mi-module-gen command to generate the Module for the WSO2 Micro Integrator.
$ bal mi-module-gen -i <path_to_ballerina_project>Above command generates the connector zip in the same location.
-
Clone the repository ballerina-mi-module-gen-tool
-
Build the tool and publish locally:
[!IMPORTANT] You need to set the
packageUserandpackagePATenvironment variables to your GitHub username and Personal Access Token (PAT) respectively. These are required to publish the tool to your local repository.$ export packageUser=<your_github_username> $ export packagePAT=<your_github_pat>
Then run the build command:
$ ./gradlew clean :tool-mi-module-gen:localPublish
$ ./gradlew testUse the dedicated Gradle task instead of enabling TestNG methods:
$ ./gradlew :mi-tests:generateExpectedArtifacts -PartifactTarget=project1artifactTargetcan be one ofproject1,project2,project3,project4,project6, orcentral.- For
central, optionally override Central packages with-PcentralPackage=org/name:version,org2/name2:version2(defaults toballerinax/milvus:1.1.0,ballerinax/azure.ai.search:1.0.0). Multiple entries generate artifacts for each package, placing them in per-connector folders derived fromorg-name.
Example for Central pulls:
$ ./gradlew :mi-tests:generateExpectedArtifacts -PartifactTarget=central \
-PcentralPackage=org/name:1.0.0,org2/name2:2.0.0As an open-source project, Ballerina welcomes contributions from the community.
For more information, go to the contribution guidelines.
All the contributors are encouraged to read the Ballerina Code of Conduct.