Webmethods Business Process Model
Business Process Model Correlation using field
This post explains creating Business Process Model Correlation using field.
Correlation in simple words is connection or association of two or more things. In terms of Business Process, it is the association of two or more Business Process instances. Business Process instances are correlated using Correlation Id. Correlation Id is unique id which associates a running Business process instance with the other Business Process instances with same Correlation Id. It is unique across the Integration server. When found an already running Business Process instance with same correlation Id, directs an event to the waiting Business process instance.
As we will be discussing Correlation using field, field is described below:
Field : A parameter in the subscription document.
Let's start with our today's example.We will assume that we will be designing the process for calculating the salary after getting the tax details of a person from Tax department and send an email to HR.
There are two subscription documents:
1. employeeSalary (HourlyRate,Fname,LName, SSN,WorkingHrs)
2. taxDetails (SSN, TaxAmount)
Here SSN is the Correlation Id associating the two Business Processes.
Create the above two documents of Publishable type.
Let's see the steps for creating the above Business Process Model:
- Receive Employee Details Activity:
- Create Activity of "Receive" type. Label it as "ReceiveEmloyeeDetails".
- Go to the Implementation tab of the "ReceiveEmployeeDetails" Activity.
Implementation Tab of Activity
- Select the Receive Protocol, in this example we have selected the Subscription (For Broker Documents).
- Select the Receive Document (employeeSalary of Publishable type)
- Go to the Correlation tab, select the radio button "field" and provide the SSN in the text box (as SSN is Correlation Id).
- calculateSalary Activity:
- Create an Activity of type "Service". Label it as "calculateSalary".
- Create a flow service "calculateSalary"which accepts employeeSalary (HourlyRate,Fname,LName, SSN,WorkingHrs) as input and returns calculateSalary (SSN, Salary) as output document .
- Under Implementation properties of "calculateSalary" Activity browse the "calculateSalary" flow service created in above step.
- Refresh the input/output tabs. This will automatically get the input/output of the activity.
Implementation tab of calculateSalary Activity
- Receive Tax Details Activity:
- Create Activity of type "Receive" and name it “ReceiveTaxDetails.
- In the Implementation tab of properties, choose the document taxDetails as subscribing document. This document contains SSN and Tax Amount.
- In the Correlation tab, chose the Field radio button and select SSN field.(as this is our Correlation Id).
- In the input/output tab, the output will have the taxDetails document as output.
- Log Salary Activity:
- Create activity of type "Service" and name it "LogSalary".
- Create a flow service which accepts taxDetails and CalculateSalary documents as input and returns 'salaryDeduted" as output.
- In the implementation tab under properties select the above created flow service.
- In the join tab, select Join type “AND”. This means that "LogSalary" Activity will only be execute when both the incoming links are true.
- Create Terminate to stop the process.
After the Business Process Model has been created, we need to Build and Upload for execution.
Use the "Build and Upload for execution" in the designer. Once it says Successfully build and uploaded.
Running the Business Process Model on My Webmethods Server:
- Run the employeeSalary document.
- Go to the MWS->Monitoring->Business->Process Instances. See the process, it will be waiting on the taxDetails document for the process to be completed.
Business Process waiting for the taxDetails document to complete the process.
- Once the taxDetails document is submitted, process will be completed and 'LogSalary" activity will execute service which will send email to HR.
Business Process completed after submitting taxDetails Document
You might also like