Working with Service Tasks
com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.

Working with Service Tasks

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,

  • Download the product installer from here, and run the installer.

  • Select and download the relevant WSO2 EI tooling ZIP file based on your operating system from here and then extract the ZIP file.
    The path to this folder is referred to as <EI_TOOLING>throughout this tutorial.

Let's get started! This tutorial includes the following sections:

Creating the artifacts

Follow the steps below to create the requires artifacts.

Creating the BPMN project

  1. Create a new BPMN project named HelloWorldBPMN. For instructions, see Creating a BPMN Project.

  2. Create a BPMN Diagram named HelloWorld.bpmn. For instructions, see Creating the BPMN Diagram.

  3. Add a Start Event, Service Task, and End Event and connect them as shown below to create a basic process. 

  4. 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

Creating the Maven project

The BPMN Project includes only the model of the Service Task. You need to create the implementation of it separately in a Maven Project. Follow the steps below to create the Maven Project for the Service Task.

  1. Create a Maven project for the HelloWorld Service Task by navigating to File > New > Other and searching for the Maven Project Wizard. Click Next.

  2. Select Create a simple project (skip archetype section) option and click Next.

  3. Enter the following details and click Finish.
    Group Id:org.wso2.bpmn
    Artifact IdHelloWorldServiceTask



  4. Click Open Perspective on the below message, which pops up.

  5. Adding external JARs to the Service Task:

    1. In the Project Explorer, right click on the project HelloWorldServiceTask and select Properties

    2. In the window that opens up click, Java Build Path, go to the Libraries tab and click on Add External JARs

    3. Select the activiti-all_5.21.0.wso2v1.jar file from the <EI_Home>/wso2/components/plugins directory.

    4. Click Open and then click Apply and Close.

Creating the Java Package for the Maven Project
  1. Navigate to File -> New -> Other and search for the Package wizard to create a Java package and click Next.

  2. Create a package named org.wso2.bpmn.helloworld.v1, and click Finish.

Creating the Java Class for the Maven Project
  1. Navigate to File -> New -> Class to create a Java Class for HelloWorld Service task implementation.

  2. Create a class named HelloWorldServiceTaskV1 and add org.activiti.engine.delegate.JavaDelegate interface to your class.

  3. Click Finish.

  4. Implement the business logic of the HelloWorld Service Task in the HelloWorldServiceTaskV1.java file 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 { public void execute(DelegateExecution arg0) throws Exception { System.out.println("Hello World ...!!!"); }
  5. Configure HelloWorld Service Task Class name. 

    1. To do this go to your HelloWorld BPMN diagram and select the Hello World Service Task box in the diagram.

    2. Access the Properties tab and select the Main Config tab.

    3. For the Class name field, select HelloWorldServiceTaskV1 and save all changes.

  6. Press Ctrl+S to save all your artifacts.

Deploying the artifacts

Follow the steps below to deploy the artifacts.

Deploying artifacts of the BPMN Project

  1. For instructions on creating the deployable artifacts, see Creating the deployable archive.

  2. For instructions on deploying them, see Deploying BPMN artifacts.

Deploying artifacts of the Maven Project

  1. Add the following dependency to the pom.xml file of the Service Task as shown below.

    <packaging>jar</packaging> <dependencies> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-engine</artifactId> <version>5.17.0</version> </dependency> </dependencies>
  2. In the Package Explorer, right click on the HelloWorldServiceTask, and click Run as → 7 Maven install.

    This builds the <ECLIPSE-WORKSPACE>/HelloWorldServiceTask directory and creates a compressed JAR file. The  HelloWorldServiceTask-1.0.0.jar file is created in the <eclipse-workspace>/HelloWorldServiceTask/target directory.

  3. Copy the HelloWorldServiceTask-1.0.0.jar  file to the <EI_HOME>/lib directory.

  4. Restart the Business Process profile of WSO2 EI.

Testing the output

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.