Example of Asynchronous BPEL process using WAIT Activity

Introduction:

I have explained about synchronous BPEL process in my previous article. Now we will discuss about an example of asynchronous BPEL process. Asynchronous BPEL is one way process and does not wait for response for further processing.

We will see some difference between synchronous BPEL process and asynchronous BPEL process.

Synchronous and Asynchronous BPEL process can be defined based on their operational behavior. If triggering point of a BPEL process waits until a response returns from the same, then it can be recognized as synchronous process and if it continues with the other set of operations then the process will be asynchronous.

Synchronous BPEL process receives client request in one port and sends back reply using reply activity on the same port on which client is waiting. Asynchronous BPEL process receives the request on one of the ports and sends back the reply from another port (callback port).

Synchronous BPEL process has one invoke activity which will invoke the service. But asynchronous BPEL process invokes the service using invoke activity and replies back using receive activity.

Synchronous BPEL process has one reply activity. Callback activity only occurs in asynchronous BPEL process.

Provider role from WSDL is mapped to myRole attribute and requester role from WSDL is mapped to partnerRole attribute. Synchronous BPEL process supports provider role only.

Example:

I will go through the asynchronous activity using a�?Waita�? activity. Please follow the below steps.

  1. Create a SOA project. Right click on Application -> New -> Projects -> SOA projects. Enter project name as AsyncBPELAsynchronous_BPEL_1
  2. Click on NEXT button and select Composite With BPEL ProcessAsynchronous_BPEL_2
  3. Click on FINISH button and BPEL Process Creation wizard will open. Enter the following details to set up BPEL process.Name = AsyncBPELProcessTemplate = Asynchronous BPEL ProcessInput and output message will be remain default value.Check the below screenshot also for further optionAsynchronous_BPEL_3
  4. Initially Asynchronous BPEL process will look like below screenshot. As it is an asynchronous BPEL process, callbackClient will be available instead of replyOutput.Asynchronous_BPEL_4
  5. Select Assign activity from component palette and drag and drop it in between receiveInput and callbackClient. Drag and drop Wait activity also after Assign activity.Asynchronous_BPEL_5
  6. Double click on Assign activity and add an expression. Click on Expression icon on the right upper side of the assign window.Asynchronous_BPEL_6
  7. Add the below expression.Asynchronous_BPEL_7
  8. Now assign window will look like this.Asynchronous_BPEL_8
  9. Change the property of the Wait activity. Enter 30 seconds time in Wait activity. This will make the process to be waited for 30 seconds.Asynchronous_BPEL_9
  10. Now the BPEL process will look like the below screenshot.Asynchronous_BPEL_10
  11. Deploy the project and test it from EM console.Asynchronous_BPEL_11
  12. Enter input string and click on Test Web Service. It will not display the output.Asynchronous_BPEL_12
  13. Click on Launch Flow Trace and you will see that AsyncBPELProcess is still running. But the process has completed without waiting for wait process to complete.Asynchronous_BPEL_13 Asynchronous_BPEL_14
  14. Wait for 30 seconds. After 30 seconds it will get completed.Asynchronous_BPEL_15
  15. Click on AsyncBPELProcess instance and go to Flow tab to check the flow in the BPEL process.Asynchronous_BPEL_16
  16. If you click on callbackClient, you will get the expected output.Asynchronous_BPEL_17

Leave a Reply

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

Show my latest post here