Implementing Correlation (Property Promotion) without any Common Element

I recently encountered a scenario where I had to implement correlation without any common element between the outgoing and incoming messages. Generally we implement correlation by Initializing and following correlation on the same element.

Let’s come to our sample for better understanding.

We have two schemas “Candidate” with fields as CandidateID, Name City and Status and “Employee” schema with fields as EmployeeID, Name, ReportingCity and ReportingManager.

We need to initialize correlation for CandidateID and follow correlation on EmployeeID. But as these are two different elements so they can’t become one CorrelationType. However they hold the same value.

Candidate, Employee & PropertySchema

 Candidate, Employee and Property Schema Image

Solution: – I created a PropertySchema with one element as “UniqueID” and promoted CandidateID and EmployeeID against it.

How to achieve it:-

  • Create on property schema with one element as “UniqueID”
  • In Candidate schema, Right click on CandidateID-> show promotion ->Property Fields -> Click on top right corner a folder like icon (Add new Property Schema) and select the property schema created in first step.
  • Now click on the CandidateID and “Add”. This will add the property for CandidateID field as shown below.

PropertyPromotion

Property Promotion Image

  • Perform the same steps to promote EmployeeID field as well present in Employee Schema.

Let’s have a look into the final schemas. If you notice in the Properties section you will find PropertyName = “UniqueID”. It means EmployeeID or CandidateID will be promoted against UniqueID field present in Property Schema.

Employee Schema

EmployeeSchema

Employee Schema Image

Candidate Schema

CandidateSchema

Candidate Schema Image

Let’s create our Orchestration to meet our requirement. Only important thing to notice is how the correlation set is created and later used.

CorrelationSet

Creating Correlation Set Image

Later in Orchestration I have initialized Correlation while sending the Candidate information for approval and followed the same while receiving the Employee Info (Approved Candidates)

Orchestration

 Orchestration Image

Some interesting things:-

Created a test file with CandidateID = 1 and processed the same.

PromotedPropertiesOfCandidateSchema

Promoted Properties of Candidate Schema Image

Subscription Filter on Correlated Receive shape:-

https://CorrelationWithoutCommonElement.PropertySchema.UniqueID == 1  And

http://schemas.microsoft.com/BizTalk/2003/system-properties.ReceivePortID == {6D17881D-4468-4EFD-A4EB-A05327E8DAE7}  And

http://schemas.microsoft.com/BizTalk/2003/system-properties.MessageType == http://CorrelationWithoutCommonElement.Employee#Employee

Correlated Receive shape has an instance subscription i.e. an instance of Orchestration is waiting for a particular type of message.

The main motive of this sample is to demonstrate how to do property promotion if you don’t have any common element.

Hope it helps.

Download the sample application from here. Word version of this blog is here.

 

Contact Me:-

@Gmail, @Facebook, @LinkedIn, @MSDN Technet Profile, @My Personal Blog Site

Advertisements

2 thoughts on “Implementing Correlation (Property Promotion) without any Common Element”

  1. Thanks. Lots of people don’t understand that the main purpose of property schemas is to create properties which map to different elements in different document schemas.This is needed for correlations, convoy patterns, and many other scenarios.

    You’ve explained it very well.

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s