Asynchronous vs Synchronous BPEL process in SOA

This article explains the difference between an asynchronous and a synchronous process with the help of a simple example below:

Suppose there are two processes SynchronousBPELProcess and AsynchronousBPELProcess. Also, there is a third process which we’ll call as Client. The Client invokes the above processes.

If client invokes SynchronousBPELProcess.

  • Client invokes SynchronousBPELProcess.
  • SynchronousBPELProcess gets instantiated and starts its operations while Client waits for the response from the SynchronousBPELProcess.
  • SynchronousBPELProcess completes its operations and sends a response back to Client.
  • Client continues and completes its processing.

If Client invokes AsynchronousBPELProcess

  • Client invokes AsynchronousBPELProcess.
  • AsynchronousBPELProcess gets instantiated and starts its operations while Client also continues to perform its operations.
  • AsynchronousBPELProcess completes its operations and callback the Client with the response message.

Here we noticed that if a synchronous process is invoked, the operations of this process has to be completed first and only then the client can resume its operations while in the case of asynchronous both the process continues to perform their operations.

Image: An image showing bpel diagram of an asynchronous and a synchronous process.


Synchronous Process:

The synchronous process defines one two-way operation port to receive the request and send the response. Using the invoke activity the client invokes the Synchronous BPEL process on this port and waits to receive the response on the same port. As soon as the client receives the response from the BPEL process it continues with its flow. On the BPEL process side, the Synchronous BPEL process gets instantiated on receiving the client request and sends back the reply using the reply activity on the same port on which the Client is waiting.

Asynchronous Process:

In the asynchronous process two one way operations ports are defined to receive the request and send the response. On the client side, the client uses the invoke activity to invoke the asynchronous BPEL process and continues with its flow. It uses the receive activity to receive the response later in the flow. The asynchronous BPEL process receives the request on one of the ports and sends back the reply from another port (callback port). To send the response the asynchronous BPEL process invokes the client on the callback port using the callback activity.

Image: An image showing the wsdl of an asynchronous and a synchronous process.

Image: An image showing a call to asynchronous and synchronous process.

Leave a Reply

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