Hi All,
To identify the messages (requests, delayed responses) in asynchronous communication, we can use Correlation Sets.
It correlate the messages when interacting with the Asynchronous systems.
In BPEL for asynchronous communications is implemented with WS-Addressing internally to identify the partner to whom we need to send the callback using the unique id.
We can override the default implementation (WS-Addressing) , using Correlation Sets.
You can use correlation sets in invoke, receive, pick, and reply activities to indicate which correlation sets occur in the messages that are sent and received.
The values of each correlation set uniquely identify the process instance. This is true even if the process instance has already reached an end state, such as the finished state
Use Case:
In typical business systems like “Order Management”, we will place an order request and to deliver the ordered items it may take some time. Once the requested items are delivered then the order request will be closed. In mean while we can cancel the order request as well.
To cancel the order request, we will be providing the unique data provided while placing the order request.
Steps in creating Correlation Set:
1. New SOA Application--> New Project --> New Composite
2. Create an asynchronous BPEL , expose it as soap service
3. Edit the XSD according to the requirement
4. Edit the wsdl
Composite will look like below:
5. Create Process Logic inside .bpel, add wait activity
6. Edit Recieve add correlation Set for Recieve message
Select Correlations ( Demonstrating by Creating a new Correlation Set )
Here query Does not get generated and we are not having a declarative method to create , So Click "CTRL+Space" and drill down to OrderID
Make Initiate as YES while creating correlation Set for recieve activity
7. Add OnMessage branch , Add Terminate
8. Edit OnMessage , Edit existing correlation Set to add a property for Cancellation message
generate query ( ctrl+space --> drill down to cancellation OrderID )
Now that we have added OrderID from cancellation message, we are having 2 properties under the same Correlation Set.
9. Now as we have built our composite it will look like below:
10. Deploy, test for OrderRequest Operation
10. Test for OrderCancellation Operation ( here we try to cancel the same order placed )
The running Process gets Terminated and the on message branch gets executed
Thus our use case is justified!
Let's Keep exploring SOA!
- Krithika :)