Webmethods Business Process Management (BPM)- Call Activity

In this tutorial we will discuss how to use the call activity in your business process. We will cover the following points:

  1. Difference between ‘Call-Activity’, and ‘Sub-process’.
  2. Example using the ‘Call Activity’.

 

Note: This tutorial is valid for webMethods versions 8.X to 9.X. You need to be familiar with webMethods business process familiar. 

If you are not familiar with developing a business process with webMethods, please read the article on the following link:

webMethods Business Process Management (BPM) – Getting started

1. Difference between ‘Call-Activity’, and ‘Sub-process’.

Call Activity: it a step in a business process which invoke an existing ‘callable’ business process model. The business process which uses the call activity is called ‘Parent process’, and the called process is called ‘Child process’.

‘Sub-process’: is a block/group of steps in the business process, it is used to make reading the model easier, or repeat the sub-process in a loop.

So the difference is that the ‘Call activity’ can be used in more than one model to perform a specific functionality, but ‘Sub-process’ is used inside one business process, and it can’t be used in another model because it is simply a group of steps in a model.

2. Example using ‘Call Activity’

objective: develop a business process for a bank to issue a new credit card. The process will:

  • Validate if the customer already exists in the bank system or not.
  • If the customer doesn’t have an account, the process will call another business process ‘createCustomer’ to create the user profile. The ‘CreateCustomer’ process should be available for future use by another business process.
  • The business process will send the order to issue the credit card and send it to client.

So we are going to develop two business models:

  1. Create Customer (callable business process/ child business process),
  2. Credit card request (the parent business process)

Note: We will discuss the details related to creating the callable business process, and using the call activity. We will not discuss the details of the regular steps as we already explained it in our earlier tutorials.

1. ‘CreateCustomer’ business process

This process should be callable business process and it should follow the specification of BPMN 2.0 (Business Process Model and Notation) as the use webMethods business process is deprecated (we will discuss the BPMN 2.0 specification in future tutorials).

Here is the process model:

CallAct- create Customer Model

The differences between this process model and any other regular business process(webMethods business processes) are in the start, end step, and configuring the ‘Global Process Specifications’.

The process must start with a ‘non-start event’ step (the empty green circle), and it must ends with the ‘End’ step (the empty red circle).

call activityin the palette

The start, and End steps are for marking the starting point, and end point of the model only, that’s why there is no input or output document in the implementation tab.

non start event property

The remaining steps are:

‘validateData’: is a service task to make sure that all the requires fields are present.

‘CreateCustomer’: is a service task responsible in creating the customer in the bank system, and it is called only if the validation result is ‘true’ (Valid=true).

‘PrepareOutputDoc’: is a service task which is responsible to map/construct the final output document which will be passed to parent/caller model. The join type on this step  ‘Un-Synchronized OR ’ which means it will be executed if only one of the conditions was true (Valid= true, or valid != true).

The last and important step is configuring the ‘Global Process Specifications’. Click anywhere outside of the process pool of the process and you will find the business process properties in the property tab, choose the ‘Global Process Specifications’ as per the below image.

createCustomer - global process specification

Add the document type of the input and output in the ‘Input/output specification for callable process’. This step is important for the following reasons:

a) The process engine will search for the output document type in the pipeline while terminating the process instance in the runtime to be returned to the parent/caller business process.

b) For the caller/parent business process the callable business process is like a service call and its input/output parameters are the parameters defined in the ‘Global Process Specifications’.

This model is ready, please deploy it to be able to use/call it from the parent business process in the next section.

2. ‘CreditCardRequest’ process

Which is responsible for checking if the customer is an existing customer or not. If it found that it is a new customer the process will call the callable business process ‘CreateCustomer, then it issues the credit card for the customer.

Credit card request

The process is a regular business process following the rules we discussed in our earlier tutorials. The new is the use of the call activity to call another business process ‘CreateCustomer’ as a step in the business process. From the palette choose the ‘Call Activity’.

call activityin the palette

Click on the call activity step in your model to configure the business process to be called in the ‘properties > Implementation’ tab.

call activity properties

We will choose the type ‘BPMN callable process’, and we will press the ‘…’ button to choose the business process.

Note: You have to compile/deploy the callable business process (createCustomer)to be able to choose it.

If you go to the inputs/outputs parameters of the ‘Call activity’ step you will find the parameters of the callable business process which were defined in the ‘Process Global Specifications’.

Please deploy the process after finishing the development of the other steps (validation service, choosing the subscription document for the parent process, …)

Note: In the run time you will find one instance for the parent model(CreditCardRequest), and another one for the child model (createCustomer) in myWebmethods.

We hope that you find what you are looking for in our tutorial, and we are looking forward reading your comments and questions.

Follow us:

on twitter: @WM_Expert

Group on LinkedIn: webmethodsExpert.com

(C) 2015 Hossam Elsharkawy. All rights reserved.

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.