Few Concept
we need to understand to know about Correlation
Correlation is an important concept in SOA to manage the flow of messages or requests, especially in scenarios involving asynchronous communication or long-running processes.
Message Tracking: Correlation in SOA helps track and associate messages or requests as they move through various services or components within a distributed system.
Use of correlation sets to ensure that asynchronous callbacks locate the appropriate client.
Why is Correlation Important:
Asynchronous Communication: In SOA, services often communicate asynchronously, meaning that requests and responses are not sent and received immediately. Correlation is crucial for matching a response with its original request, even if there is a time delay between them.
Long-Running Processes: In business processes that involve multiple steps and potentially take a long time to complete, correlation ensures that all related activities are associated with the correct process instance.
Synchronous & Asynchronous web services:
Whenever a synchronous web
service is invoked from Oracle BPEL via a partnerlink, only one port is
established for communication with the exposed web service which is used by
both request & response messages.
When an asynchronous web
service is invoked, two ports are opened for communication. one for request
& one for response messages.
CORRELATION ID
A correlation ID unique to the client request.
Correlation happens while runtime process where multiple processes may be waiting for service callbacks, Oracle BPEL Server must know which BPEL process instance is waiting for a callback message
The correlation ID enables Oracle BPEL Server to correlate the response with the appropriate requesting instance.
Correlation Id: A common approach to implementing correlation is to assign a unique identifier (correlation ID) to each request or message. This ID is included in the message payload or message headers.
Message Routing: As messages or responses are received by various services, the correlation ID is used to route them to the appropriate destination or process.
Context Management: Correlation IDs are often used to manage the context of a specific interaction, allowing services to link responses back to the original request.
Use Cases for Correlation in SOA:
Order Processing: In e-commerce systems, when a customer places an order, the system generates a unique correlation ID for that order. As the order progresses through various stages (payment processing, shipping, etc.), the correlation ID ensures that all related actions are tied to that specific order.
Workflow Management: In workflow automation, correlation helps manage complex, multi-step processes. Each step or activity can be associated with a specific process instance using a correlation ID.
Asynchronous Communication: Correlation is essential in scenarios where a service initiates an asynchronous operation (e.g., sending a request to a message queue) and later needs to link the response back to the original request.
Correlation set
Using the Correlation set we can override the default implementation (WS-Addressing) by the “Content based” to use request data.
Why & Where Correlation?
1. When the external web service called doesn't
have WS-Addressing capability
2. use correlation sets to ensure that
asynchronous callbacks locate the appropriate client.
3. When the message travels through several
services and the response is requested by the initial service from the last
service directly.
Ex: when the conversation is in the form A > B > C >
A instead of A > B > A.
Implementing
Correlation in SOA:
The following are
few scenarios in which we would be required to implement Correlation to
identify & relate message communication;
a.)
Creating Correlation Sets:
· In
Structure Window of the JDeveloper IDE, right click on the Correlation Sets and
choose 'Create Correlation Set'
· Provide a
name for your correlation set being created.
· In the
properties section, select 'Add' to display the property chooser window
· Choose
'Create' to create a property on which the correlation has to be initiated.
· Provide a
name and type for the property.
b.) Associating the Correlation set on receive/invoke, pick activities
·
Go
the the correlations tab on the activity (invoke/receive/pick) on which you
need to set & validate the correlation
·
Add
the created correlation set to the activity
Initiate Attribute: (Value Set - yes, no)
Ø When set to yes, correlation set is initiated with
the values of the properties available in the message being transferred
Ø When set to no, correlation set validates the value
of the property available in the message
Pattern Attribute: (Value Set - in, out, in-out)
Ø When the value is 'in', it means that the
correlation property is set/validated on the incoming message
Ø When the value is 'out', it means that the
correlation property is set/validated on the message going out of BPEL
Ø In case of 'in-out', the property will be
set/validated on both incoming & outgoing messages
c.)
Creating Property Alias:
Ø In the Structure Window of the JDeveloper, right
click on the 'Property Aliases' and select 'Create Property Alias'
Ø Select the message type that you want to set to the
correlation property (already created)
Ø Now, correlation design is complete. However,
correlation will not be established unless we reference the correlations on the
WSDL file of the BPEL process.
Ø To do this, import the correlation WSDL file
(created under the project) in the BPEL process main WSDL.
How does Oracle BPEL identify asynchronous responses?
WS-Addressing (default) or Correlation
WS-Addressing?
WS-Addressing defines the concept of Endpoint References (EPRs), which are used to uniquely identify the endpoints of web services.
An EPR typically includes information such as the service's address (URL), the reference properties (e.g., security information), and a reference parameters block.
By default, Oracle BPEL PM implements WS-Addressing for all asynchronous web service calls, hence we don't have to explicitly implement identification relationship between the incoming & outgoing messages.
How WS-Addressing is Used in SOA:
Message Routing: WS-Addressing enables dynamic message routing by specifying the destination endpoint for a message. This is particularly useful in scenarios where a message needs to traverse multiple intermediaries before reaching its final destination.
Asynchronous Communication: WS-Addressing is often used in asynchronous communication patterns. The "Reply To" property allows a service to specify where the response to a request should be sent, which is essential for asynchronous processing.
Reliable Messaging: WS-Addressing can be employed to facilitate reliable messaging by ensuring that messages are uniquely identified (using the "Message ID" property) and that responses are correlated with their respective requests.
Message Exchange Patterns: WS-Addressing is compatible with various message exchange patterns, including one-way, request-response, and callback patterns, making it suitable for a wide range of SOA scenarios.
Security: WS-Addressing can be used in conjunction with WS-Security to enhance the security of web service interactions in SOA. It allows you to specify security-related addressing information, such as the "To" and "Action" properties.
In summary, WS-Addressing in SOA provides a standardized way to include addressing information in SOAP messages, allowing for more flexible, reliable, and secure web service communication. It plays a vital role in enhancing the capabilities of web services within a service-oriented architecture by enabling features such as message routing, asynchronous communication, reliable messaging, and security.
WS-Addressing in an Asynchronous Service
Nice blog thanks for all information.
ReplyDeleteThanks for your comment Raj :)
DeleteThanks Diksha for providing the detailed information on co-relation. This is really very helpful.
ReplyDeleteKeep it up !!
Thanks for your comment :)
DeletePlease provide such information on some other topics in SOA as well, e.g Authentication, user creation in LDAP etc
ReplyDeleteThanks for your comment, sure I will provide more details in LDAP concept. For Authentication you can refer below link:
Deletehttps://teachmesoa.blogspot.com/2020/07/authentication-for-client-service.html