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 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.
- 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
Candidate Schema
Let’s create our Orchestration to meet our requirement. Only important thing to notice is how the correlation set is created and later used.
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)
Some interesting things:-
Created a test file with CandidateID = 1 and processed the same.
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 , @Twitter, @LinkedIn , @MSDNTechnet, @My Personal Blog