Search code examples
web-servicesasynchronousbpel

BPEL: Asynchronous/Synchronous pattern


I would like to know if it is correct.

The pattern receive - reply is used for sync web services. In this case it is possible to define a single port in wsdl file.

The invoke pattern, indeed, is used to make also async web service. In this case, in the wsdl are defined two ports.

So, my question is: Is it possible to use only reply activity to create async calls?

Thank you in advance.


Solution

  • I don't really understand your question, however I try to explain the sync vs. async relation in BPEL, hoping that it also answers your question:

    a) Even a two-way request-response operation (which looks like a synchronous operation) can be bound to an asynchronous transport protocol (like SMTP, JMS, XMPP, AMQP...)

    b) The patterns you are describing are correct for incoming service call, i.e. when a client calls the BPEL process instance. If the WSDL of your BPEL process defines an operation as request-response, you need to model this as a receive-reply pair in your BPEL. This can be considered a synchronous call (but see a)). If for some reason this operation cannot be bound to an asynchronous transport protocol, and for some reason (e.g. long-running processing in between) the invocation must be asynchronous, you need to split the operation into two one-way operations. This means that the process is now providing one operation for the original request, and the caller now has to provide one one-way operation for the original response. This is modeled as receive-invoke pair in BPEL. Both are interconnected via partner links. This is at asynchronous as it gets.

    A single reply does not make sense, since a reply activity is always connected to a receive activity, i.e. it is only responsible for the response part of an operation and cannot be used for one-way operations. If you want to call an external service, use invoke. With request-response operations, the invoke will directly return the result. If the call should be async, use an invoke-receive pair, each providing/calling a one-way operation.

    HTH, Tammo