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.
...
Tip | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before you begin,
|
Let's get started! This tutorial includes the following sections:
...
Drag and drop a Timer Boundary Event from the Boundary event tab of the Palette, and place it above the Review leave request User Task.
- Click on the Timer Boundary Event and click the Main config section of the Properties tab.
- Change the value of the Cancel activity field to
false
since you are not going to cancel the existing User Task, and e nter a value in the ISO_8601 format for the Time duration , within which you want the escalation to happen (e.g.,PT60S
for 60 seconds).
- Add a new Mail Task to the diagram. This will send an escalation email.
- Click on the Mail Task, and change the value of the Name field to
Send escalation email
in the General section of the Properties tab.
- Hover your mouse pointer over the Timer Boundary Event , and click on the arrow icon (i.e., the Create Connection option) and connect it to the Send escalation email Mail Task .
- Add a Terminate End Event and connect the Send escalation email Mail Task to it.
- Save all the artifacts that you created in WSO2 Integration Studio.
The model is now complete as the necessary logic has been applied.
...
- In the Main Config section of the Properties tab (of the Send escalation email Mail Task), fill the respective fields (i.e., To, From, Subject). You can give the
Pending Leave Requests
. - In the Non-HTML field of the Main Config section, enter
Please approve the pending leave requests
. The variable will be used to create the email body. Copy the following JAR files into the
<EI_HOME>/lib
directory and restart the Business Process profile server instance.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
andmailServerPort
property values as follows:Code Block language xml <property name="mailServerHost" value="smtp.gmail.com"/> <property name="mailServerPort" value="587"/>
Add the following properties:
Code Block language xml <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>"/>
Info 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
- For instructions on creating the deployable artifacts, see Creating the deployable archive.
- For instructions on deploying them, see Deploying BPMN artifacts.
...
If you have not started WSO2 EI previously, start it.
Panel borderColor #542989 bgColor #ffffff borderWidth 1 Localtabgroup Localtab title On MacOS/Linux/CentOS Open a terminal and execute the following command:
Code Block wso2ei-6.4.0-business-process
Localtab title On Windows Go to Start Menu -> Programs -> WSO2 -> Enterprise Integrator 6.4.0 Business Process. This will open a terminal and start the business process profile.
- Log in to the Management Console of the Business Process profile.
- Click Configure → Users and Roles → Add → Add New User.
Enter the below details to create a user called
manager
and click Next.Tip Enter both the User Name and the Password as
manager
.In the next screen, assign the user to the
admin
role and click Finish.You view the new user you created as shown below.
...