Panel |
---|
Panel |
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:
|
Note |
---|
See the Business processes topic for a description of the concepts that you need to know when creating the artifacts: |
Tip | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before you begin, Install Oracle Java SE Development Kit (JDK) version 1.8.* and set the JAVA_HOME environment variable.
|
...
- In WSO2 EI Tooling, open the Developer Studio dashboard by clicking the Developer Studio menu and choosing Open Dashboard, and select BPMN Project .
- Create a new project named AppointmentCancellation.
- Click Finish.
- Click Open Perspective in the Open Associated Perspective? window.
- In Developer Studio Dashboard, select BPMN Diagram.
- Select the
AppointmentCancellation/src/main/resources/diagrams
directory as the parent folder, and enterAppointmentCancellation.bpmn
for the File name.
- Click Next, select the option to create an empty diagram as shown below, and click Finish.
- 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.- Add a StartEvent from the Start Event palette.
Select the Properties tab, click Form, click New, update the following and click OK.
Id patientName Name Name of the Patient Type string Required True Repeat clicking New and adding the following to add the other form properties one by one.
Id Name Type Required appointmentNo
Appointment Number long True doctor
Name of the Doctor string True reason
Reason for cancellation string True email
Email Address string True Add a REST Task from the WSO2 Tasks palette.
Select the Properties tab, click General and give the Name asGet Appointment
, then click Main config and update the following:Service URL http ://localhost:9090/healthcare/appointments/validity/${appointmentNo}
HTTP method GET Output Variable Mappings noOfDays:$.status
- Add an Exclusive Gateway from the Gateway palette.
- Add a User Task from the Task palette and name it
Appointment Control Task
.
- Click Properties, click Main config and give
admin
as the Assignee.
In the Properties tab click Form, click New and add the following.
Id Name Type Variable Readable Writable Required approveCancellation
Do You Approve the
Appointment Cancellation Request?enum appointmentNo True False True Click New next to Form values and add the following:
Id Name approve Approve reject Reject Repeat clicking New and adding the following to add the other form properties one by one.
Id Name Type Variable Readable Writable Required AppNo
Appointment Number long appointmentNo True False True cancellationReason
Reason For The Cancellation string reason True False True doctorName
Name of the Doctor string doctor True False True - Add another Exclusive Gateway from the Gateway palette.
- Add a REST Task from the WSO2 Tasks palette.
Select the Properties tab and click Main config and update the following:
Service URL http://localhost:9090/healthcare/appointments/validity/${appointmentNo}
HTTP method DELETE Output Variable name status Add a MailTask from the Task palette below the second Parallel Gateway and name it
Reject cancellation Task
.
Select the Properties tab and click Main config and update the following:To ${email}
From Enter a valid SMTP email address. Subject Appointment cancellation rejected Html Appointment cancellation request with Appointment Number ${appointmentNo} has been rejected. Thank you.
Administration DepartmentAdd another MailTask above the second Parallel Gateway and name it
Approve Cancellation Task
.
Select the Properties tab and click Main config and update the following:To ${email}
From Enter a valid SMTP email address. Subject Appointment cancellation successful Html Appointment cancellation request with Appointment Number ${appointmentNo} has been approved. Thank you.
Administration Department- Link each activity by hovering over the element, selecting the arrow sign and dragging it to the connecting element as shown below.
- Add a StartEvent from the Start Event palette.
- Click on the arrow leading from the first Exclusive Gateway to the
Approve Cancellation Task
, and in the Main config section of the Properties tab add the${noOfDays >2}
condition.
Click on the arrow leading from the first Exclusive Gateway to theAnchor reject reject Reject Cancellation Task
, and in the Main config section of the Properties tab add the${noOfDays<2}
condition.
- Click on the arrow leading from the second Exclusive Gateway to the
Rest Task
, and in the Main config section of the Properties tab add the${approveCancellation == 'approve'}
condition.
- Click on the arrow leading from the second Exclusive Gateway to the
Reject Cancellation Task
, and in the Main config section of the Properties tab add the${approveCancellation == 'reject'}
condition.
- Click the arrow leading to the Appointment Control Task, open the General tab that is under properties and note the Id.
Example:
- Click the first exclusive gateway, open the General tab that is under properties, and select the ID you noted in the above steps as the value for Default flow.
- Save all the changes you have made.
- Click Window -> Show View -> Other in the top menu of Tooling.
- Type
Package Explorer
in the search bar, select it and click Open.
- In the Package Explorer, right-click the
AppointmentCancellation
project and select Create deployment artifacts.
This will create aAppointmentCancellation.bar
file in thedeployment
folder:
...
Info | |||||||
---|---|---|---|---|---|---|---|
Before you begin, apply the following configurations to the business process profile: <EI_HOME>/lib directory.Open the Replace the Code Block | the business process profile:
|
You can now deploy the .bar file of the BPMN process using the management console of the business process profile in WSO2 EI.
...
|
You can now deploy the .bar file of the BPMN process using the management console of the business process profile in WSO2 EI.
- Open a terminal and navigate to the
<EI_HOME>/wso2/business-process/bin
directory. Start the Business Process profile:
Panel borderColor #542989 bgColor #ffffff borderWidth 1 Localtabgroup Localtab active true title On MacOS/Linux/CentOS Open a terminal and execute the following command:
Code Block wso2ei-6.3.0-business-process
Localtab title Windows Go to Start Menu -> Programs -> WSO2 -> Enterprise Integrator 6.3.0 Business Process. This will open a terminal and start the Business Process profile.
- Open the management console from
https://localhost:9445/carbon/
. - Log in using admin as the username and password.
- Go to Main -> Manage -> Add ->BPMN and upload the
AppointmentCancellation.bar
file by browsing in the workspace directory of your Tooling instance as shown below.
...
Let's start the Message Broker profile:
Panel | |||||||||
---|---|---|---|---|---|---|---|---|---|
| |||||||||
|
...
|
Anchor | ||||
---|---|---|---|---|
|
Info | ||
---|---|---|
Before you start the ESB profile, configure the profile so that it can connect to the Message Broker profile for reliable messaging. To do this, open the
|
Now, let's start the ESB profile in WSO2 EI and upload the ESB artifacts:
On the Servers tab of Developer Studio, expand the WSO2 Carbon server, right-click SampleServicesCompositeApplication, and choose Redeploy. The Console window will indicate that the CApp has deployed successfully.
Tip |
---|
If you do not have a server added in Eclipse, refer this tutorial. |
Info |
---|
You can also deploy the artifacts to the ESB profile of WSO2 EI using a Composite Application Archive (CAR) file. |
...
To be able to send requests to the back-end service (which is an MSF4J service deployed in the MSF4J profile of WSO2 EI), you need to first start the MSF4J runtime:
...
Start the runtime by executing the MSF4J startup script as shown below.
...
|
Now, let's start the ESB profile in WSO2 EI and upload the ESB artifacts:
On the Servers tab of Developer Studio, expand the WSO2 Carbon server, right-click SampleServicesCompositeApplication, and choose Redeploy. The Console window will indicate that the CApp has deployed successfully.
Tip |
---|
If you do not have a server added in Eclipse, refer this tutorial. |
Info |
---|
You can also deploy the artifacts to the ESB profile of WSO2 EI using a Composite Application Archive (CAR) file. |
Anchor | ||||
---|---|---|---|---|
|
To be able to send requests to the back-end service (which is an MSF4J service deployed in the MSF4J profile of WSO2 EI), you need to first start the MSF4J runtime:
Panel | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
|
The system is now ready to receive appointment reservation requests.
...