Managing a business process

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

Managing a business process

In this tutorial, you will use a BPMN process defined in the Business Process profile of WSO2 EI to manage the process of canceling a doctor's appointment. The appointment cancellation process should be designed according to the following requirement:

  • The patient should be allowed to cancel the appointment (unconditionally) if the appointment date is at least two days away.

  • The patient should not be allowed to cancel the appointment if the appointment date is less than two days away.

  • If the appointment date falls on the second day from the current date, the patient can request for appointment cancellation, which should be manually approved by an administrator.

  • The patient should receive email notifications informing if the appointment cancellation is accepted or rejected.

See the following topics for a description of the concepts that you need to know when creating WSO2 EI artifacts:

Before you begin,

  1. Install Oracle Java SE Development Kit (JDK) version 1.8.* and set the JAVA_HOME environment variable.

  2. 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> through out this tutorial.

  3. 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> through out this tutorial.

    For more detailed installation instructions, see the Installing Enterprise Integrator Tooling.

  4. Download the CAR file that contains the integration artifacts from the previous tutorial from here.

  5. Download the MSF4J service from here and copy the JAR file to <EI_HOME>/wso2/msf4j/deployment/microservices folder. The back-end service is now deployed in the MSF4J profile of WSO2 EI.

Let's get started!

Creating the appointment cancellation process using BPMN

  1. In WSO2 EI Tooling, open the Developer Studio dashboard by clicking the Developer Studio menu and choosing Open Dashboard

  2. Select BPMN Project and create a new project named AppointmentCancellation.

    Click Finish.

  3. In Developer Studio Dashboard, select BPMN Diagram. Create a file named AppointmentCancellation.bpmn and select the AppointmentCancellation/src/main/resources/diagrams directory as the parent folder.

  4. Click Next, select the option to create an empty diagram as shown below, and click Finish.

  5. Let's start drawing the BPMN process diagram for the appointment cancellation process. The AppointmentCancellation canvas. The Palette on the right side of the AppointmentCancellation canvas contains all the activity symbols that will be used for drawing the process as shown below.


    Let's get started. You can easily drag and drop the activities from the Palette the canvas, and then update the properties and configurations of each activity as explained below.

    1. Add a StartEvent activity.

    2. Add a REST Task and name it Get Appointment.


      Select the Properties tab and click Main config and update the following:

    3. Add a Parallel Gateway.

    4. Add a User Task and name it Appointment Control Task.

    5. Add another Parallel Gateway.

    6. Add a REST Task.

      Select the Properties tab and click Main config and update the following:

    7. Add a MailTask below the second Parallel Gateway and name it Reject cancellation Task.


      Select the Properties tab and click Main config and update the following:

    8. Add another MailTask above the second Parallel Gateway and name it Approve Cancellation Task.

    9. Link each activity by hovering over the element, selecting the arrow sign and dragging it to the connecting element as shown below.

  6. In the Package Explorer, right-click the AppointmentCancellation project and select Create deployment artifacts. This will create a AppointmentCancellation.bar file in the deployment folder:

Deploying the BPMN process in the Business Process profile

Before you begin, apply the following configurations to the business process profile:

  1. Copy the following JARs to the <EI_HOME>/lib directory.

  2. Open the activiti.xml file in the <EI_HOME>/wso2/business-process/conf directory and add the following properties under <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration"> as shown below to enable the Gmail configurations.

    • Replace the "mailServerHost" and "mailServerPort" property values as follows:

      <property name="mailServerHost" value="smtp.gmail.com"/> <property name="mailServerPort" value="587"/>
    • Add the following properties:

      <property name="mailServerDefaultFrom" value="wso2com@gmail.com"/> <property name="mailServerUseTLS" value="true"/> <property name="mailServerUsername" value="wso2com@gmail.com"/> <property name="mailServerPassword" value="wso2carbonuser"/>

You can now deploy the .bar file of the BPMN process using the management console of the business process profile in WSO2 EI.

  1. Open a terminal and navigate to the <EI_HOME>/wso2/business-process/bin directory.

  2. Start the Business Process profile in WSO2 EI by executing one of the following commands:

    • On Linux/Mac OS:  sh wso2server.sh

    • On Windows:  wso2server.bat --run

  3. Open the management console from https://localhost:9445/carbon/.

  4. Log in using admin as the username and password.

  5. Go to Main -> Manage -> Add ->BPMN and upload the AppointmentCancellation.bar file as shown below. 

Deploying the Integration artifacts in the Integration profile

Before you start the Integration profile, configure the profile so that it can connect to the Broker profile for reliable messaging:

  1. Open the <EI_HOME>/conf/jndi.properties file and update the connection factories and queues at the beginning of the file so that it now looks like this:

    # register some connection factories # connectionfactory.[jndiname] = [ConnectionURL] connectionfactory.QueueConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5675' connectionfactory.TopicConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5675' # register some queues in JNDI using the form # queue.[jndiName] = [physicalName] queue.MyQueue = example.MyQueue queue.PaymentRequestJMSMessageStore=PaymentRequestJMSMessageStore
  2. Copy the following JARs from the <EI_HOME>/wso2/broker/client-lib folder to the <EI_HOME>/lib folder.

    • andes-client-3.2.13.jar

    • geronimo-jms_1.1_spec-1.1.0.wso2v1.jar

    • org.wso2.securevault-1.0.0-wso2v2.jar