This is the latest release in the 6.x.x family. For EI 7.0.0, click here.

All docs This doc
Skip to end of metadata
Go to start of metadata

The following scenario simulates a simple leave approval business process, in which an employee fills a form and submits the leave request to the manager and the manager approves or rejects it. The employee receives an email if the manager approves the request. Otherwise, if the manager rejects it, the employee will be able to resend the leave request by adjusting it. 

You can use Signal Events to perform an additional external task depending on the status of a business process. Thus, S ignal Events pass information about an event in a BPMN process.  For example, in this scenario if the manager has to update a leave management system whenever he/she approves a leave request of an employee. You can use a Signal Event to pass information about the leave approval before sending the confirmation email to the employee.

You can download the  pre-packaged project  of this scenario and compare the artifacts in it when following the below instructions.

Before you begin,

  • Download the product installer from here, and run the installer.
    Let's call the installation location of your product the <EI_HOME> directory. This is located in a place specific to your OS as shown below:
    OSHome directory
    Mac OS/Library/WSO2/EnterpriseIntegrator/6.6.0
    WindowsC:\Program Files\WSO2\EnterpriseIntegrator\6.6.0\
  • Select the relevant WSO2 Integration Studio based on your operating system and download it from here.
    The path to this folder is referred to as <EI_TOOLING> throughout this tutorial.

    Getting an error message? See the troubleshooting tips given under Installing WSO2 Integration Studio.

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

Importing artifacts 

If you did not try the Working with Timer Boundary Events tutorial yet, follow the steps below to import its artifacts as you will be extending on that.

  1. Download the pre-packaged project and extract it to a preferred location. This contains the artifacts of the Working with Timer Boundary Events tutorial. 
  2. Open the WSO2 EI Tooling environment.
  3. Click File, and click Import
  4. Expand the WSO2 category, select Existing WSO2 Projects into workspace and click Next.
  5. Click Browse, select the file you extracted and upload it.  
  6. In the Package Explorer, double click on the name of the BPMN diagram to view the BPMN artifacts you imported.

Creating new artifacts

The next step of the process is adding the Signal Event for the manager to update a leave management system when the manager approves a leave request. Follow the steps below to implement this.

  1. Click on the canvas,click Signals in the Properties tab and click New,  to add a new signal definition.

  2. Enter the following values to add attributes to the signals.

    • ID - leaveSignal

    • Name - Leave Signal

    • Scope - global

  3. Drag and drop a Signal Throwing Event to the canvas from the Intermediate event tab of the Palette.

  4. Click on the Signal Throwing Event  and  select Leave Signal (leaveSignal) as the Signal ref  in the  Main config  section of the  Properties  tab.

  5. Hover your mouse pointer over the Exclusive Gateway , and click on the arrow icon (i.e., the  Create Connection  option) and connect it to the  Signal Throwing Event .
  6. Click on the arrow, which connects the  Exclusive Gateway  to the Signal Throwing Event  and enter  ${vacationApproved == 'true'}  as the value for  Condition  in the  Main config   section of the  Properties  tab.
  7. Hover your mouse pointer over the Signal Throwing Event , and click on the arrow icon (i.e., the  Create Connection  option) and connect it to the Send confirmation email Mail Task .

    Now, a signal will be thrown whenever the manager approves a leave request.
  8. Drag and drop a Signal Start Event to the canvas from the Start event tab of the Palette.

  9. Click on the  Signal Start Event  and  select Leave Signal (leaveSignal) as the  Signal ref  in the  Main config  section of the  Properties  tab.

  10. Drag and drop a  User Task  to the diagram from the Task tab of the Pallet .
  11. Click on the User Task and  enter  Update records  as the  Name  in the  General  section of the Properties tab.

  12. Hover your mouse pointer over the Signal Start Event , and click on the arrow icon (i.e., the  Create Connection  option) and connect it  to the Update records  User Task .

  13. Right click on the arrow, which connects the Exclusive Gateway to the Send confirmation email Mail Task and click Delete.

  14. Click on the Update records User Task, click New in the  Form  section of the  Properties  tab and add the following fields.  

    IdNameTypeVariableDate patternReadableWritableRequired
    numberOfDays Number of days long
    startDate First day of holiday (dd-MM-yyyy) string
    dd-MM-yyyy hh:mm truetruetrue
    employeeName Name of employee string

    You view the fields you added as shown below.

  15. Click on the Update records   User Task and enter manager as the Assignee in the Main config section of the Properties tab.

  16. Drag and drop a  End Event  to the diagram from the End event tab of the  Pallet .
  17. Hover your mouse pointer over the Update records  User Task , and click on the arrow icon (i.e., the  Create Connection  option) and connect it  to the  End Event .

  18. Press  Ctrl+S  to save all the artifacts, which you created in WSO2 EI Tooling.
    The model is now complete as the necessary logic has been applied.

Configuring the Mail Tasks to send emails

If you have not already done, follow the steps below to configure the Mail Tasks to send emails.

  1. Copy the following JAR files into the<EI_HOME>/lib directory and restart the Business Process profile server instance. 

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

    • Replace the mailServerHost and mailServerPort property values as follows:

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

      <property name="mailServerDefaultFrom" value="<ENTER_A_VALID_SMTP_EMAIL_ADDRESS>"/>
      <property name="mailServerUseTLS" value="true"/>
      <property name="mailServerUsername" value="<ENTER_A_VALID_SMTP_EMAIL_ADDRESS>"/>
      <property name="mailServerPassword" value="<ENTER_THE_EMAIL_PASSWORD>"/>

      If you are using Gmail to try out this scenario, you may need to enable IMAP access for Gmail. For more information, see Enable IMAP settings in Gmail . Also, if you receive an authentication error, you may have to adjust your account access settings in Gmail as well. For more information, see Allowing less secure apps to access your account .

Deploying the artifacts

  1. For instructions on creating the deployable artifacts, see Creating the deployable archive.
  2. For instructions on deploying them, see Deploying BPMN artifacts.

Creating the user

  1. If you have not started the business process profile previously, start it.

    Open a terminal and execute the following command:


    Go to  Start Menu -> Programs -> WSO2 -> Enterprise Integrator 6.6.0 Business Process. This will open a terminal and start the business process profile.

  2. Log in to the Management Console of the Business Process profile.
  3. Click Configure → Users and Roles → Add → Add New User.
  4. Enter the below details to create a user called manager and click Next.

    Enter both the User Name and the Password as manager.

  5. In the next screen, assign the user to the admin role and click Finish.

    You view the new user you created as shown below.

Testing the output

Follow the steps below to test the output.

  1. Log in to the BPMN-explorer at https://localhost:9445/bpmn-explorer using admin for both the username and password.
  2. Click PROCESSES in the top menu, and click the Start option of the Leave Approval Process.
  3. Initiate the process by filling the form and click Start.

    You view the following message.

  4. Log out and log in again using manager/manager credentials. 
  5. Click TASKS and then click MY TASKS. You view the Claimable Task, which was created by the process you started. 

  6. Click on the Task, select A pprove from the drop down list and click Complete Task.

    This creates a Task for the manager to update the records of the leave management system.

  7. Click on this task, enter the details of the leave request you approved, and click Complete Task to update records of the leave management system.

  • No labels