Friday, December 13, 2013

We usually came across many scenarios where we need to coordinate between Master and Detail (Child) process to achieve our objective.
In new version of SOA, Signal activity is introduced which helps us to coordinate between Master and Detail process.
Let’s talk about one business scenario where we need to coordinate between Master and Detail process i.e. where we need to use Signal activity in BPEL.
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.


In This post, I will show how we can implement above business scenario in SOA (BPEL).
Create Details process (Bank). In this post I will refre Detail process as Child process.
 

Made it as one way process and add receive signal activity after receive activity. Name it as “RecieveSignalFromMaster” and put label as “PrimarySignal” and choose master from drop down list.
<bpelx:receiveSignal name="ReceieveSignalFromMaster" label="PrimarySignal" from="master"/>


Add wait activity and then add Signal activity to send signal back to Master.
<wait name="WaitFor1min" for="'PT1M'"/>
 <empty name="DoSomeworkhere"/>
<bpelx:signal name="Signal_SendBackToMaster" label="SecondarySignal"  to="master"/>


Complete Child Process flow.


Now Create Master process (Airline). Make it one way process.

Now we need to invoke Child process from master process. So add child process WSDL and Schema file in Master process and create Child process partner link.
Don’t forgot to click “Invoke as Detail” checkbox

Add Signal activity to send signal to child process.
<bpelx:signal name="Signal_SendToChild" label="PrimarySignal" to="details"/>
Add Receive Signal activity to receive signal from Child process
<bpelx:receiveSignal name="receiveSignalFromChild" label="SecondarySignal"                         from="details"/>
 Complete flow of Master process
  
Testing Result







0 comments :

Post a Comment