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 Business Process Management (BPM) – Getting Started

What is webMethods BPM?

The conflict between the business and technology people is one of the major challenges that affect the company performance and limit its abilities to reach its goals.

WebMethods BPM will allow you to develop your business process in a graphical way which will facilitate the communication between business and technology people. Business people will jump on-board and particiapte in the design phase which will increase the chance of designing superior products.

This article will be one of a series to uncover how to develop and optimize a process with webMethods BPM.

Note : All the information in this article is based on webMethods version 8, however the same knowledge might be applicable for later versions.

In this article we will cover the following points :

  1. The advantages of using webmethods BPM.
  2. How to decide to use the BPM or not?
  3. Webmthods BPM Getting started.
    1. Prepare and configure the designer.
    2. Create a new business process.
    3. Available componenets/steps in webmethods BPM.
    4. Design your first BPM.
  4. Conclusion.

 

1     The advantages of using webMethods BPM

  1. Visualize the bussiness process, which will make it easier for the business people to particiapte to make sure that you are building the rigth process.
  2. You can use webMethods Optimize for process, to see how your business is doing, the Service level agreement (SLA), failure rate, process bottlenecks).
  3. Visualize the status of a specific request (process instance), and what are the executed steps.
  4. Resubmitting failed request/process from any step in the business process.

 

2     How to decide to use the BPM or not?

BPM processes are consuming a lot of hardware resources, so depnding on the nature of your project we will decide to use it or not.

SoftwareAG designer enable two modes for the desiging the process :

  1. Business analyst : can only draw/design the sequence of the process steps to represent the business process from the business prespective.
  2. Process Developer : avail more options to transform the design done by the business analyst to real business process capable of processing the business request.

If you have a project which involves a lot of steps and interacting with many systems then the BPM might be very helpful to see the statistics, resubmit from a specific point, facilitate the communication between the IT and business, … etc. But if your project is small which involves 1 or 2 steps then it is better to save the resources for something else and use the regular flow services, triggers, schedulers, … etc to develop your project.

3     WebMethods BPM Getting Started

In this section we will start our way to build our first webmethods Business Process Model. So in this section when we say BPM we mean business process model NOT business process management.

         3.1   Prepare And configure the SoftwareAG Designer

  • We will use ‘SoftwareAG Designer’ to develop our webMethods business process model.
  • Define the Integration server you are going to use as follows :
    • Go the the menu Windows –> Preferences.
    • Expand the item SoftwareAG in the list at left side of the preference window.
    • Choose ‘Integration Server’.
    • Edit the configuration of the ‘default’ server, and press ‘Ok’ to save the configuration.

edit default IS

 

 

  • In the preferences window –> Software AG –> Process development –> Process Audit database, choose ‘Use Integration Server JDBC Pool’, and the server ‘Defualt’.

This configuration is used to deploy the definition of the business process model to the integration server database.

Question : Why we are using the ‘Default’, and is it possible to choose another server name?

The answer is Yes, you can choose another server name (ex. DevServer), but when compiling the business model the Designer will generate a folder with the server name, so it is inconvenient to find your code inside a folder called ‘DevServer’ in the production. This is the reason behind using the ‘default’ server.

process Audit DB

  • Now its time for changing the right perspective in the Designer. To develop/modify your Business process you have to be in the ‘Process Development Perspective’, to change the perspective from the main menu Window –> open perspective –> other –> choose ‘Process Development’ from the list.
  • The current perspective will be shown under the Designer main menu.

process developement prespective

        3.2 Create a new Business process

         1. To create a new Process Project, from the Designer main menu : File –> New –> Process Project.

         2. Choose the name of the your project (the project might contain more than a business model), we will use the project name                      ‘DemoProcessroject’.

         3. To create a new process model, from the Designer main menu : File –> New –> Process, we will name the process as
’DemoProcess’.

create new process

                 4. In the properties Tab –> General, you will find the main properties of the new process :

                       Process name : DemoProcess

                      Process ID : DemoProcessProject/DemoProcess

                      Version : 1

            The process ID is very important as it will be the unique key of this process in webmethods database and in the process engine.

 3    Available components/steps in webmethods BPM.

      The screenshot below show all the possible options to use to build your business process model.

Palette

The following table will describe the most used components :

Name

Descrpition

Pool – Pool

Is the main layout or box which will contain all your process model activities

Activities – Service Task

A step in the process model which will call a flow service in the IS.

Activities – User Task

A step means that the process require user intervention/action in My webmethods(WM task).

Activities – Send Task

Is a step that takes a publishable document as input and publish it.

Note : If publishing the document failed, you will not receive an error (may be softwareAG released a fix for this problem). However you can publish a document through a normal flow service called by ‘service task’

Activities – Receive Task

Is the starting point of the processing or receiving response in the middle of the process. The receive task is a trigger in the Integration server.

     

3.4 Design your first process

       Target Example :

       We want to design a process for online magazine subscription and here is the steps :

        1.  The process will receive the customer request.

        2.  we will validate the input data (customer name, credit card length).

        3.  Perform the payment transaction.

        4. Update the customers database.

        5. Send confirmation email to the customer.

        6. Inform the customer with the failure if any of steps 2, or 3 failed.

Lets start designing our model :

Assumptions : we assume that you already created a publishable document in the Integration server, and you will publish it for each customer request.

       1. Open the SoftwareAG designer, and create a new process project ‘DemoProcessProject’.

       2. Create a new process ‘DemoProcess’.

       3. Change the Designer perspective to ‘Process Development’.

      4. Make sure that you are in the ‘Process Development’ mode.

analyst and designer mode

      5. From the Palette on the right of the page, in the new process design area drag and drop a pool.

     6. A pop up window will ask you if you want to set pool type. Choose ‘Internal’

set pool type

      Note : You can use the external organization to show the detail internal for other systems (not a part from your process), it is only for reference. So thats why you must have at least one ‘Internal pool’ and none or multiple ‘External pool’.

       7. Drag and drop ‘Receive Task’ into the process pool, and name it ‘receiveRequest’ from the property tab.

      8. Make sure that the check box ‘Allow this receive task to start new process’ in the property tab is checked (as it is the starting point of the model).

receiveRequestStep

        9. Here is a screenshot from the publishable document we will use.

publishable doc def

     10.  Go to the properties tab –> Implementation, and chose the document you created in the last step in the ‘Receive Document’.

implementation receive step

     11. Then we will continue drawing the steps, and drag an arrow between the steps to define the sequence by dragging the arrow from a step to another.

We have created all the steps graphically, and the model will look like this :

final process layout

       12. For each step except ‘ProcessEnd’ go to the properties tab –> Implementation, and chose the Integration server flow service to be called to implement the logic you want.

For example in the below screenshot for the step ‘payFees’ we are calling the service ‘paymentTransaction’.

step call IS service

       13. Go to the properties tab –> Inputs / Outputs, refresh the inputs and output and you will see the input and output of the IS flow service became the input & output of the process step.

pay fees screenshot

      14. The step ‘InformCustomer_failed’ which is responsible to inform the customers of the problems is reachable from two steps ‘validateInput’, and ‘payFees’. So to define the conditions to execute this step click on the arrow coming from the other two steps.

       In the properties tab –> condition, choose the variable that you want to use in the condition, in the example below the processing will go from the step ‘payFees’ to ‘InformCustomer_failed’ only if the value of the variable ‘result’= ‘Error’ (result is an output parameter from the step payFees).

step condition

        15. We have to configure the step ‘InforCustomer_Failed’ by going to the properties tab –> Joins, then choose the type you want. In our example we will use ‘Unsynchoronized OR’.

step joins config

Here are the possible values of the join:

Value

Meaning

Unsynchoronized Or

Execute the step if one condition from the two has been satisfied

Or

Wait till the evaluation of all conditions (on the arrows leading to the step), then start the evaluation.

Usually it is used if you don’t want to continue the processing without terminating the previous steps.

And

Execute when all conditions have been satisfied.

Complex

Use complex customer logic to decide whether to execute the step or not.

     16.  The end step is marking the end of the processing and it will decide the status of the process instance. For example in the below screenshot we are making the process status as ‘Completed’. (other possible value is ‘Failed’)

configureEndStep

     17. After configuring all the steps in the process model, its time for ‘Build & Upload for Execusion’ it is the button with the label ‘010’ in the below screenshot.

Build and upload for execusion

      18. You will receive a message asking whether to enable the process or not after building it, we will choose ‘Yes’ to be able to start using the new process by publishing the subscription document  to the broker.

automatically enable the process for execusion

     19. The build report will confirm the status of the build as the below screenshot.

Build report

    20. You can make sure that the process status is ‘Enabled’ from the MWS –> Administration –> Business –> Business Process.

process Def in MWS

       To start a process instance from the model all you have to do is publishing a document and the model’s trigger will pick it up for processing. To check the running instance go to MWS –> Monitoring –> Process Instance.

Thank you for visiting our website. We are looking forward reading your comments and questions.

Follow us:

on twitter: @WM_Expert

Group on LinkedIn: webmethodsExpert.com

(C) 2014 Hossam Elsharkawy. All rights reserved.