Sunday, 27 July 2014

Exploring Correlation

Correlation

While dealing with one of the new CRs we came across the need of implementing correlation with DB Polling although there were lots of explanation on the different blogs regarding correlation and DB Polling but non of them explains exactly how to do that.So in the following post along with theoritical explanation I would also explain the steps to achieve correlation in our process later in my next post I will also explain the DB Polling.

Lets Start with the Introductive explanation 


In common business scenarios it is not possible to have a synchronous response to each of our requests. Mostly the business has to deal with vendors, who would need to undergo a detailed process to come up with a solution. However, this response may not be necessarily binding business from carrying on its other activities. In such scenarios, the business enters in to asynchronous communication with these third parties. The async process necessarily stresses that the response may come back at a later time, through callback or polling mechanism as is suitable.


In case of a single instance its quite easy to match the response to request, however, when there are multiple instances the business would be wondering which request has been responded to. For example, if a travel booking agent spawns 10 requests for Frankfurt to Paris, and after a while airline responds to one of those 10 requests, it would not be safe to assume that this is a response to first request only. Hence the travel agent would tag in an ID to segregate one request for another, and would expect the airline to return this id unaltered to match the request. This id, which enables requestor to correlate the response sent by the provider, is called Correlation Id.


How (in Oracle BPEL)

Oracle BPEL provides us with two mechanisms through which an asynchronous callback message could map to its calling instance in the crowd.
  • WS-Addressing
  • Correlation Sets
WS-Addressing

“How does the callback maps to the correct instance out of so many waiting processes”, it’s a very common surprise to all beginners, creating first ever Asynchronous Invoke in BPEL Process Manager. The answer is, any time an asynchronous service is invoked, Oracle BPM, instills a message UID in WS-Addressing headers that float with SOAP Packets, which are used internally by the BPEL Server to correlate the flowing request/response.

This is the default mechanism supported by Oracle BPEL Process Manager, which is overridden automatically when the user opts to create his own correlation set.

Correlation Sets


Correlation Sets enable you to correlate asynchronous messages based on message body contents.

The reasons, to use content-based correlation:-


1. The asynchronous web service invoked by BPEL does not support/understand WS-Addressing headers.
2. When BPEL instance is expecting messages from a third party, for example, a file-poller.
3. When asynchronous call has multiple hops and reply is received directly from end system. For example, Request path is A > B > C > D and response comes to A directly from D, i.e. D > A.


Steps to achieve Correlation.



























































This completes correlation here  in my next post I will provide steps to use DBPolling along with correlation .