This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Creating a BPMN Process
Let's take a simple HelloWorld scenario where there is a BPMN process that prints out a 'Hello World!' message when a process instance is initiated.
In this tutorial, you create a BPMN process using the WSO2 Enterprise Integrator (WSO2 EI) Tooling.
Before you begin,
Install Oracle Java SE Development Kit (JDK) version 1.8.* and set the JAVA_HOME environment variable.
Install Maven. For more information, see Installation Prerequisites.
Download the WSO2 EI ZIP file from here, and then extract the ZIP file.
The path to this folder will be referred to as<EI_HOME>throughout this tutorial.Select and download the relevant EI tooling ZIP file based on your operating system from here and then extract the ZIP file.
The path to this folder will be referred to as<EI_TOOLING>throughout this tutorial.
Let's get started!
This tutorial includes the following sections:
Creating the process and service task
In WSO2 EI Tooling, open the Developer Studio dashboard by clicking the Developer Studio menu and choosing Open Dashboard.
Select BPMN Project and create a new project named HelloWorldBPMN.
Click Finish.In Developer Studio Dashboard, select BPMN Diagram.
Create a file named HelloWorld.bpmn and select theHelloWorldBPMN/src/main/resources/diagramsdirectory as the parent folder and click Next.
Select the option to create an empty diagram and click Finish.
Add a Start Event, Service Task, and End Event as shown below to create a basic process.
Link each activity by hovering over the element, selecting the arrow sign and dragging it to the connecting element.
Click anywhere on the canvas, go to the Properties tab, and fill in the following details:
Id :helloworld
Name :Hello World Process
Namespace:http://wso2.org/bpmn/helloworld
Create a Java project for HelloWorld Service Task by navigating to File > New > Other and searching for the Java Project Wizard.
Create a Project named HelloWorldServiceTask and click Finish.
Adding external JARs:
In the Project Explorer, right click on the project HelloWorldServiceTask and select Properties.
In the window that opens up go to the Libraries tab and click on Add External JARs.
Select the
activiti-all_5.21.0.wso2v1.jarfile from the<EI_Home>/wso2/components/pluginsdirectory, and click Finish.
Navigate to File -> New -> Other and search for the Package wizard to create a Java package and create a package named
org.wso2.bpmn.helloworld.v1.
Navigate to File -> New -> Class to create a Java Class for HelloWorld Service task implementation.
Create a class names HelloWorldServiceTaskV1 and addorg.activiti.engine.delegate.JavaDelegateinterface to your class.
Click Finish.
Implement the business logic of the HelloWorld Service Task in the
HelloWorldServiceTaskV1.javafile as shown below.package org.wso2.bpmn.helloworld.v1; import org.activiti.engine.delegate.DelegateExecution; import org.activiti.engine.delegate.JavaDelegate; /** * Hello World Service Task- V1. */ public class HelloWorldServiceTaskV1 implements JavaDelegate { @Override public void execute(DelegateExecution arg0) throws Exception { System.out.println("Hello World ...!!!"); } }Configure HelloWorld Service Task Class name.
To do this go to your HelloWorld BPMN diagram and select the Hello World Service Task box in the diagram.
Access the Properties tab and select the Main Config tab.
For the Class name field, selectHelloWorldServiceTaskV1and save all changes.
Creating the deployable artifacts
In the Package Explorer, right click on the HelloWorldBPMN project and click Create deployment artifacts.
This creates aHelloWorld.barfile in thedeploymentfolder.
Navigate to the
<ECLIPSE-WORKSPACE>/HelloWorldServiceTaskdirectory via the command prompt.Build the directory to create a compressed JAR file.
mvn clean installThe
HelloWorldServiceTask-1.0.0.jarfile is created in the<eclipse-workspace>/HelloWorldServiceTask/targetdirectory.Copy the
HelloWorldServiceTask-1.0.0.jarfile to the<EI_HOME>/libdirectory.