Search 800 + Posts

Nov 21, 2009

How to Design BPEL Process With Pick ( OnMessage and On Alarm) Activity.

In this blog I will discuss BPEL to BPEL Interaction With Timeout.
A client sends a request to a service and waits until it receives a reply, or until a certain time limit is reached, whichever comes first.

In this Example - A BPEL process(Process1) client: uses an Invoke to send an asynchronous request to the service (BPEL Process 2), and a Pick activity with:
- An onMessage branch to receive the response (callback)
- An onAlarm branch to manage the timeout condition if it occurs before the response is
received.

Step # 1 - Drag and Drop the BPEL process and Name them 1 and Process 2.Import the Message Type "OrderInfo" and assign them to Input and output variable, please refer my other blogs on BPEL to get more details about How to Import Message Type.



Step #2 - Design the BPEL Process 1.
  1. BPEL Process 1 is a Synchronous Process.
  2. Add Invoke activity to Call BPEL Process 2.
  3. Add Pick activity.Pickout activity has 2 type of outcome , OnMessage and OnAlarm. Set An onMessage branch to receive the response (callback) and an onAlarm branch to manage the timeout condition if it occurs before the response is received.
  4. Add Assign Activity Assign_2 with OnMessage branch and Assign activity Assign_3 with the OnAlarm activity.
  5. In Assign_2 activity , asign Satus element of "OrderInfo" MessageType with value  'OnMsg' and  Status2 element with value 'BP Pick'
  6. In Assign_2 activity , asign Satus element of "OrderInfo" MessageType with value  'T Out' that indicate that it is Time out Activity.



Step # 3 - Design BPEL Process 2.In this Process Drop Assign activity between Receive and Callback and a delay activity (Waiit_1) between Assign and Callback.Assign activity just assign input to output.



Step # 4 - Configure the Wait activity to 5 seconds.It Means after Assign_1 activity there will be a delay of 5 seconds.



Step # 5 - Configure OnMessage activity of BPEL Process 1 and set the BPEL Process 2 as partner link (that means OnMessage activity in BPEL Process 1 will receive the call from the BPEL Process 2) and also associate the input variable as shown below.



Step # 6 - Configure the OnAlarm activity of Pick activity and set the tine = 59 seconds.That means if the OnMessage Branch has not been process within 59 seconds that BPEL will trigger the OnAlaram branch of theflow.



Step # 7 - Run the BPEL Process .Please note that in BPEL Process we have a delay of 5 seconds and OnAlaram branch in Process1 will trigger only if OnMessage will not get any response with in 59 seconds.
In Our case since delay in Process 2 is 5 seconds , On Message will get response in 5seconds and output will Print the variable assign in Assign activity_2 .
Satus = 'OnMsg' and  Status2 = 'BP Pick'


Step # 18- Once again configure the delay (Wait_1) activity of the BPEL process 2 and set the dealy time = 2 minutes .That means Process2 will take 2 minutes of dealy  between Assign and callback.
Run the BPEL Process .


Please note that in BPEL Process 1we have a delay of 2 Minutes and OnAlaram branch in Process1 will trigger if OnMessage will not get any response with in 59 seconds.In this case sinceProcess 2 will take more than 2 minutes , On Alarm branch will Triggers .


As shown below(Input)



OutPut , Status - TOut that indicates that On Alarm branch triggered.

5 comments:

  1. Hi,

    Appreciate the write up. did you try to get this working without using wait, like calling a DB Adapter and delaying the response from DB side. Would be great if you can post your findings.

    ReplyDelete
  2. Hi,

    I tried the same but got error saying "Waiting for response has timed out"
    And I also came across the below statement from Oracle document which suggest Synchronous Bpel cannot call Asynchronous Bpel.
    http://docs.oracle.com/cd/E28280_01/dev.1111/e10224/bp_interact.htm#SOASE537

    “5.2.3 Synchronous BPEL Process Invoking an Asynchronous Process
    If a synchronous BPEL process invokes an asynchronous process, the callback response message is not acknowledged by the BPEL process and the process times out waiting for a response. This type of interaction pattern is not supported.

    ReplyDelete
  3. Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you. free printable wall art

    ReplyDelete