Wednesday, September 25, 2019

SOA Suite 11g & 12c – Oracle BPEL Master and Detail process coordination using signals

We usually met many scenarios where we need to coordinate between Master and Detail (Child) process to achieve our objective.This coordination enables us to specify the tasks performed by a master BPEL process and its related detail BPEL processes. This is sometimes referred to as a parent and child relationship.

A real life example:
Suppose a customer is booking a flight through airline website, customer will choose date, destination & boarding location etc then finally make the payment to book that flight. In this case date, location etc information will go to airline and airline needs to validate customer credit card or other mode of payment from bank. Here airline will first send credit card information to Bank but first it needs to validate date, destination & other information, once it is validated then airline send message to Bank that verify credit card information and meanwhile airline will wait for the response from Bank unless it receive any response from Bank, it will not start further processing. Once response is received from Bank, airline will do the rest of processing and after that response Bank can complete their processing.
Potential coordination points are as follows:
·         The master process (Airline) must signal the detail processes (Bank) that airline validation is successful and to continue processing.
·         Detail process (Bank) must signal the master process (Airline) after credit card validation is complete.

Use cases:
Typical use cases for the signal pattern are situations where a master process can only proceed when detail processes have completed or at least reached a certain state (the master process should only send the email to the customer when the detail process has handed the order to the shipping department) or when a master process calls a detail process to start processing and then needs to do some additional work before the detail process(es) can continue to their next step (master process asks detail to start gathering quotes from car rental companies, than continues to establish the credit-worthiness of the customer and when that has been taken care of indicates to the detail process that it may continue processing).

Master Detail signal exchange
Implementation:
Step1: create a Master process.
Create a BPEL process service component. For this example, the process is
named MasterProcess.

Double click the MasterProcess BPEL process⇾In the Components window, expand Oracle Extensions⇾Signal⇾Drag a Signal activity into the designer.

Click the Signal activity to display its property fields in the Property Inspector or
double-click the Signal activity.
Name: Enter a name (for this example, contactDetailProcess).
Label:  Enter a label name (for this example,
beginDetailProcess). This label must match the receive
signal activity label you set in the detail process in Step 6.
To: Select details as the type of process to receive this signal.

Drag a Receive Signal activity into the designer.Double-click the Receive Signal activity.
Name: Enter a name (for this example, waitForDetailProcess).
Label: Enter a label name (for this example,
completeDetailProcess). This label must match the
signal activity label you set in the detail process in Step 10.
To: Select details


Step2: Create a Detail process
Create a second BPEL process service component. For this example, the
process is named DetailProcess.

Double-click the DetailProcess BPEL process⇾In the Components window, expand Oracle Extensions⇾Drag a Receive Signal activity into your BPEL process service component⇾Double-click the Receive Signal activity.
Name: Enter a name (for this example,
WaitForContactFromMasterProcess).
Label: Enter a label name (for this example,
beginDetailProcess). This label must match the signal
activity label you set in the master process in Step 6.
To: Select master as the type of process from which to receive the
signal.

Drag a Signal activity into the designer.Double-click the Signal activity.
Name: Enter a name (for this example, contactDetailProcess).
Label: Enter a label name (for this example,
completeDetailProcess). This label must match the
receive signal activity label you set in the master process in
Step 10.
To: Select master as the destination.


Step3: Create an invoke from Master to Detail process.

Return to the MasterProcess master process⇾In the Components window, expand BPEL Constructs⇾Drag an Invoke activity into your BPEL process service component⇾Double-click the Invoke activity⇾Select the DetailProcess BPEL process you created in Step 1 as the partner link⇾Select the Invoke as Detail check box.
Complete all remaining fields in the Invoke dialog, and click OK
If this is an environment in which one master process is interacting with multiple
detail processes, perform the following tasks:
Specify the bpelx:detailLabel attribute for correlating with the receive
signal activity:
    <invoke name="Invoke_DetailProcess" partnerLink="DetailProcess.detailprocess_client" portType="ns1:DetailProcess"
            operation="process" inputVariable="Invoke_DetailProcess_process_InputVariable" bpelx:invokeAsDetail="yes"
            bpelx:detailLabel="completeDetailProcess"/>


Testing:
You can see Master process is waiting to get the signal from Detail process.
Detail process is waiting for the 2 minutes wait.
After 2 mins wait, Master process gets signal from Detail process.
Detail Process completion stage



No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...