Webmethods BPM: Using Correlation Tutorial – Part 1

Today we are going to discuss how to design and develop a webmethods business process model which supports the waiting for an external event/response to resume the processing.

Here are some of the challenges when waiting for an external event/response in a business process model:

1. Avoid occupying the IS resources while waiting.
2. Avoid divide the business process into 2 processes (one before the waiting steps, and one after the waiting step) to avoid occupying the resources while waiting.

Note: Technically feasible, but you will lose the benefit of sharing the real business process with the business (or at least it will be harder), and you will lose the benefit of using some of the optimize features to know the overall performance of the business process.

3. Assure that only one request is being processed without making a lot of custom development.

Using the business process correlation will help you get over these challenges as:

  1. The waiting instance will be stored in the database without occupying any Integration Server’s resources.
  2. You will maintain your process in one model which will be easier to monitor using optimize, and sharing the process with the business people.
  3. Avoid duplicate processing, or accepting more than request from the same type by using the correlation id.

So What is the correlation Id?

            It is a unique id a cross the integration server used by webmethods business process model to check if there is a running process instance running with the same correlation id, or direct an event/response to a waiting business process instance with the same correlation id.

How can you define a business process with a correlation ID?

  1. Field: a parameter in the subscription document. (will be covered in this tutorial)
  2. Service: a service called with the business process model subscription trigger.
  3. Manual: you will manage the correlation manually during the processing using the services ‘pub.prt.correlate:establishCorrelation’, and ‘pub.prt.correlate:deleteCorrelation’.

so let start our today’s example:

Description of the process:

We will assume that we are designing a process to perform credit check for a bank before accepting a loan request. We will send the request to the credit office and our process will be waiting for the asynchronous response from the credit office. After receiving the response we will notify the customer by email.

Here is the subscription document we will use to start the model:

Field name

Description

LoanRequest

The subscription document name (publishable document)

LoanRequest/requestNumber

The unique id of the customer request

LoanRequest/socialInsuranceNumber

the social insurance number of the customer (unique government number for each person)

LoanRequest/lastName

the last name of the customer

LoanRequest/firstName

the first name of the customer

LoanRequest/dateOfBirth

the date of birth of the customer

LoanRequest/postalCode

the postal code of the customer

LoanRequest/telephoneNumber

the phone number of the customer

LoanRequest/email

the email of the customer, which will be used to inform the customer of the result of the request.

 

Here is the process model we designed:

bp main

To configure the business process model to use the correlation, please follow the following steps:

  1. Choose the subscription document which will start the model, by clicking on the receive step (NewLoanRequest in our example), go the properties tab –> Implementation, and choose the receive Document (in our example ‘LoanRequest’).

subscription step document

 

2. For the receive step move from the implementation to Correlation tab, then choose field and choose the unique field that identify the request to be your correlation id (in our example: SocialInsuranceNumber).This means that as long as the process instance is running or waiting for a response we cannot accept a new request for the same socialInsuranceNumber as it is used as a correlation id.

You might ask why we didn’t choose ‘requestNumber’? you can use it if you want to allow for the same customer (with the same socialInsuranceNumber) to submit more than a request as the ‘requestNumber’ is unique number for the customer request.

To be more clear in how we will receive the response from the credit office, we assume that we expose a web service to receive the response and then we will publish the document ‘CreditCheckResult’ to continue the processing of the model.

 

correlation tab subscription trigger

 

 

3. Assign a flow service to the step SendCreditCheck which will call the credit office web service to send the request, and we will receive the response synchronously.

4. Configure the joint of the step ‘CheckResponse’ as ‘And’, to make sure that the model will be stored in the database without using any Integration server resources in a waiting state till receiving the response of the intermediate receive step ‘ReceiveCreditOfficeResponse’.

join type properties

 

 

5. Define your response document ‘CreditCheckResult’ as follows:

Name

Description

CreditCheckResult

The publishable response document

CreditCheckResult/requestNumber

Is a unique id for the customer request

CreditCheckResult/socialInsuranceNumber

the social insurance number of the client, which acts as the correlation id in our example.

CreditCheckResult/creditScore

the credit score of the customer.

CreditCheckResult/isBlackListed

flag is indicate if the customer is blacklisted or not.

CreditCheckResult/rating

Customer rating (high profile, low profile, … etc)

 

6. Configure the intermediate receive step ‘ReceiveCreditOfficeResponse’ from the properties tab –> implementation –> Receive document.
7. Move to implementation to correlation tab, choose field and choose the ‘socialInsuranceNumber’.

             You might noticed that the document used in the intermediate subscription step is not the same as the one which started the model which is perfectly fine, the only thing to continue the processing of a waiting process is that the value of the correlation field in the intermediate receive step must equals the value of the correlation field in the receive step of the model.

correclation middle trigger

    8. Assign a flow service to the step ‘NotifyCustomer’, which will send an email to the customer with the request result.

Now your model is ready for the deployment and testing. This is all for this tutorial, and we will discuss other ways to de the correlation in the coming tutorial.

We are looking forward reading your comments and questions.

Follow us:

on twitter: @WM_Expert

LinkedIn group: webmethodsExpert.com

(C) 2014 Hossam Elsharkawy. All rights reserved.

Webmethods Optimize For process : Web Service Data Collector Tutorial

This tutorial is explaining in details how to use webmethods optimize web service data collector. So it is strongly recommended to read our first post regarding the Optimize for process if you are not familiar with webmethods Optimize for process.

Here is the link to the first tutorial:

https://webmethodsexpert.com/2014/07/20/webmethods-optimize-for-process/

As we discussed in the last tutorial, you can use the web service data collector to send events to webmethods Optimize for process to calculate and monitor the important KPIs and statistics of your business.

You can use the web service data collector to send data for optimize from a step in your business process, or from a flow service, or even from a non-webmethods program.

Note: all the information in this tutorial is for webmethods version 8.2 After applying the latest fixes. The information should be valid for webmethods version 9.x.

Let’s go directly into the steps to call the web service data collector from webmethods flow service:

  1. Make sure that the web service data collector is installed and its wsdl is accessible. Here is the url for the wsdl:

     http://datacollectorServer:12603/services/WSDimensionalDataCollector.wsdl

Replace the ‘datacollectorServer’ with the server name of the data collector. In the below screen shot we replaced it by ‘localhost’.

wsdl web service DC

      2.  Open SoftwareAG designer, and connect to the integration server.

     3. Create a new web service Descriptor from the main menu –> File –> New –> web service Descriptor.

new web Service Descriptor

    4. Choose the location of the new descriptor and it’s name. We will call the new web service descriptor wsDataCollectorClient. Then click ‘Next’.

    5. Choose to create the descriptor as ‘Consumer’, and click ‘Next’.

new WS Descriptor

        6. In the Source location, choose ‘File/Url’: enter the link of the web service data collector that we verified in earlier step, and then click ‘Finish’.

select WSDL location

   7. Please go to the package/folder used to create the new descriptor, and you will find the new WS descriptors, and the connectors (operations/services) and ready for use.

wsDC folder structure

    8. To send event to webmethods Optimize for process use can call the new generated connector ‘IMonitorDataCollector_addEvent’.

    9. Here is an example for calling the ‘IMonitorDataCollector_addEvent’:

publish to optimize flow service

attributes values

Input parameter

Value

Description

tns:addEvent

    eventType

SalesReport

The name of the event as will be seen in the MWS after sending the first event.

    tns:Event.attribtes

         n5:BusinessDataValue[0]

first element in array of fields/Attributes in the event

                      name

Quantity

field name in the event ‘SalesReport’

                      value

1

The value of the field

         n5:BusinessDataValue[1]

first element in array of fields/Attributes in the event

                      name

Product

field name in the event ‘SalesReport’

                      value

Mac Book Pro.

The value of the field

     10. We will run the service once to send the new event to Optimize.

     11. Please go to MWS –> Administration –> Analytics –> KPIs –> Business Data, and you will see the new event ‘SalesReport’ under the unmapped event.

new event in MWS

     12. If you click on the new event ‘SalesReport’, you will see the two fields ‘Quantity’, and ‘Product’ ready to be configured.

event details in mws

This is the end of this tutorial. Please check section 3 ‘Configuring the new Events in Optimize through MyWebmethods.’ from our webMethods Optimize for Process Guide to complete configuring the event in webmethods Optimize.

https://webmethodsexpert.com/2014/07/20/webmethods-optimize-for-process/

We are looking forward reading your comments and questions.

Follow us:

on twitter: @WM_Expert

LinkedIn group: webmethodsExpert.com

(C) 2014 Hossam Elsharkawy. All rights reserved.