Correlation - Interview Question of the Week #2

Correlation is the process of matching an incoming message with the appropriate instance of an orchestration. For example, orchestration sends out of a message and when the response come back it needs to consume it correctly in the appropriate instance. As you can imagine there will be multiple instances of the same orchestration running and it’s important to match the message with correct instance of orchestration.
In order to achieve this, before the orchestration send the message out it needs to inform something in the context that will uniquely identify the instance where the response should come back.
Exactly for this particular reason you need to promote a unique property as your correlation set, without this information orchestration engine cannot correlate the response messages with correct instance.

If, for example, your orchestration is designed to issue a purchase order, receive an invoice, and send out the payment, you need to be sure that the invoice message is received by the same orchestration instance that the corresponding purchase order was sent from since numbers of purchase orders may be processed at the time. In this example, the purchase order identification number can be used as a parameter in the correlation set for correlating the purchase order message and the invoice message.

There are two types of correlations in orchestration:

  1. Manual correlation
  2. Automatic correlation

In the manual correlation scenario, you manually configure the orchestrations to initialize and follow the correlation set to associate the messages with proper instances. 
In the automatic correlation scenario, the messaging engine will correlate the messages with the instances for you, for example, when you set up Request-Response port or Self-Correlating port in your orchestrations.

You must use correlation whenever your orchestration does not have an explicit way of associating a message with an instance, such as an activate receive, a request-response, or a self-correlating port.

No comments:

Post a Comment