Thursday, September 24, 2020

Correlation in BPM

 Correlation: Identifying the Correct Instance of a Process

• In an asynchronous conversation, messages can be automatically correlated by using WS-Addressing:  

è When they share a conversation

è Where the target conversation is easily identified 

è When the target conversation does not initiate yet another conversation during the original conversation

• When WS-Addressing does not apply, use message-based correlation. It:

è Identifies an instance by mapping instance data (the instance state) to a correlation key

è Is similar to using a primary key in a database table

è Can contain one or more properties

What is Correlation?

  è When two BPM process communicate with each other to exchange messages then Business have to Make sure that correct response is received by calling instance Is called Correlation

  è Business process typically can run for days or even months, which require asynchronous communication via a message.

  è Correlations enable business processes to communicate with each other based on the state of an instance. 

  è You can use the correlation sets to identify asynchronous messages to ensure that asynchronous callback locate the appropriate client.

  è The concept of correlation is used with conversation with messages to a Send Task or Receive Task.

  è Correlation can be used in BPM and in BPEL both. 

Use Cases Where Correlation Applies

• Handling message events inside an event subprocess

• Participating processes have conversations after they have both started (in the middle of the process).

• A participant (client) does not support WS-Addressing.

     Correlation Keys

  Ø  The idea is to use a joint conversation which is used outgoing and incoming messages.

  Ø  One or more key used to identify a conversation

  Ø  A Correlation Key represents a composite key.

  Ø  When you define a correlation key you provide a name to identify it.

  Ø  Any message that is sent or received will carry the value of at least one of Correlation key instance within its payload.

     Correlation Properties

     Properties are abstractions for very representative attributes in the process, like the order ID, the customer name or the social security number. Properties contain a name to identify the attribute and a data type. Properties only support basic data types.

     Correlation properties must be unique

     S1.How to Create a Correlation Key

You can create a correlation key at a project level and later use that correlation key to define the correlations of your flow objects.

To create a correlation key:

1.       Select a business process in jdeveloper.

2.       Open the Structure view.

3.       Expand the Correlations node in the Structure view.

4.       Right-click the Correlations Keys node.

5.       Select New.

6.       The Create Correlation Key dialog appears.

S2:How to Configure a Correlation Key

You can configure the properties that compose the correlation keys you define.

To configure a correlation key:

1.       Enter the correlation name.

2.       If the Correlation Properties list is empty or the property that you want to use for your correlation is not defined, you must define a new correlation property. To define a correlation property:

a.       Click the New button.

b.      The Create Correlation Property dialog appears.

c.       Enter a name for the correlation property.

d.      Select a type.

Available types are: String, Int, Real, Decimal, Bool, Time.

e.       Click OK.

3.    Select the correlation properties that define the correlation:

a.    From the Correlation Properties list, select the property you want to include in the correlation.

b.    Click the Select button.

The selected property appear in the selected list.

4.    Click OK.

S3: Go to BPMN Process and initiate the correlation

1.    Go to start message type -> Implementation -> correlation

2.    Correlation Defination

o   Select property

o   Select element from data object on which we define unique Token.

o   Check initiates which means correlation is initiated

S4: On catch Event we will call correlation to match the correlation id

Here unchecked the initiate because we want to use the correlation key 

which was initiated at on message start event.  ->Ok 


Note

The Signal Catch Event is exactly same as Signal Start event. 

The only difference is that a Signal Catch event is used to subscribe to events in between a running process  while a signal Start event is used to initialize a process.

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.

1. What is Correlation in SOA:

Message Tracking: Correlation in SOA helps track and associate messages or requests as they move through various services or components within a distributed system.

2. 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.

3. How Correlation Works:

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.

4. 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.

5. Tools and Technologies: Many middleware and integration platforms provide built-in support for correlation in SOA. Message brokers, message queues, and integration frameworks often include features for managing correlation IDs and routing messages based on them.

In summary, correlation in SOA is a mechanism for associating related messages or activities within a distributed system, ensuring that messages are correctly matched with their corresponding requests or processes, even in asynchronous or long-running scenarios. It is a fundamental concept for building robust and reliable service-oriented architectures.

User

soa correlation example 

Let's walk through a simplified example of how correlation works in the context of a Service-Oriented Architecture (SOA). In this example, we'll consider an e-commerce system where a customer places an order, and the system processes the order asynchronously, involving multiple services.

Scenario: Order Processing in an E-commerce SOA

Order Placement:

A customer places an order on the e-commerce website by selecting items and completing the checkout process.

When the order is submitted, the e-commerce system generates a unique correlation ID for this order, such as "Order123."

Asynchronous Processing:

After the order is placed, it enters a queue for processing. This is an example of asynchronous communication in SOA, where the order processing may take some time.

Payment Processing Service:

The order is picked up from the queue by a Payment Processing Service.

The Payment Processing Service processes the payment for the order.

Before sending the payment confirmation, it includes the "Order123" correlation ID in the response message to link it back to the original order.

Shipping Service:

After the payment is confirmed, the order is sent to a Shipping Service.

The Shipping Service is responsible for packaging and shipping the items.

It uses the same "Order123" correlation ID to associate its actions with this specific order.

Email Notification Service:

Once the order has been shipped, the system sends an email notification to the customer.

The Email Notification Service, when generating the email, also includes the "Order123" correlation ID in the email content.

Customer Service Interaction:

If the customer contacts the customer service department with questions or concerns about their order, the support agent can use the "Order123" correlation ID to quickly look up the details of that order and provide assistance.

Benefits of Correlation in this Example:

Tracking: The "Order123" correlation ID allows the system to track the order's progress across multiple services and interactions, even though each step may be handled asynchronously and by different services.

Accuracy: It ensures that each response or notification is associated with the correct order, preventing mix-ups or errors in the processing pipeline.

Efficiency: Customer support agents can quickly access order information using the correlation ID, reducing the time and effort required to assist customers.

Auditability: The correlation ID provides an audit trail, allowing the system to log and trace the lifecycle of each order through the various services.

This example illustrates how correlation in SOA helps manage and link related messages or activities within a distributed system, ensuring that actions and responses are correctly associated with the appropriate processes or requests.











No comments:

Post a Comment

SOA Overview Part-1

  Middleware It provides a mechanism for the process to interact with other processes running on multiple network machines. Advantages...