Implementation of OnMessage and OnAlarm in BPEL Process

In this article I will discuss about the PICK activity in BPEL process. Pick activity has two operations a�� On Message and On Alarm.A�Pick activity gets triggered only when BPEL process invokes partner link. It waits for an operation from partner link or executes another set of activities on timeout.

  1. Create a SOA project with synchronous BPEL process. Open the BPEL process and drag and drop a partner link in the right swim lane. Double click on partner link to edit the property. Enter the WSDL URL of Asynchronous BPEL example. This asynchronous BPEL activity has 30 seconds wait time to display the result.A�The Wait activity allows a process to wait for given time.Pick_Activity_BPEL_1 Pick_Activity_BPEL_2
  2. Now invoke the partner link through Invoke activity.Pick_Activity_BPEL_3
  3. Drag a wire between invoke activity and partner link and editor window of invoke will open. Partner link and port type will be selected automatically. If you want, you can select partner link manually also. Create an input variable of invoke activity.Pick_Activity_BPEL_4
  4. Drag and drop an Assign activity between receiveInput and invoke activity and do the mapping between input payload & input variable of invoke activity.Pick_Activity_BPEL_5
  5. Now use PICK activity to select between on message and on alarm operation.Pick_Activity_BPEL_6
  6. Click on clock icon to add on alarm operationPick_Activity_BPEL_7 Pick_Activity_BPEL_8
  7. Double click on OnMessage part to open editor window. Create a variable and browse PickPartnerLink partner link. Now click on OK button.Pick_Activity_BPEL_9
  8. Edit OnAlarm operation also. Enter 40 seconds time for OnAlarm operation.Pick_Activity_BPEL_10
  9. Drag and drop Assign activities under both operations. Map OnMessage input variable to output payload in one assign activity under OnMessage and assign a�?On Alarm is executeda�� to output payload in another assign activity under OnAlarm.
  10. Save the application. BPEL process will look like below screenshotPick_Activity_BPEL_11
  11. Deploy the project and test it in EM console. This time OnMessage operation will execute as wait time is less in OnMessage operation than OnAlarm operation.Pick_Activity_BPEL_12 Pick_Activity_BPEL_13
  12. Test OnAlarm operation also. Decrease the wait time in OnAlarm to 20 seconds.Pick_Activity_BPEL_14
  13. Test this application again. This time OnAlarm operation will execute. Enter any input string and see the output.Pick_Activity_BPEL_15 Pick_Activity_BPEL_16

Pick activity will select the operation which will execute fast. You can execute different operations using OnMessage activity. Refer this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Show my latest post here