Tuesday, July 15, 2014

Different methods of property promotion inside Orchestration

What is Property Promotion ?

Property promotion is a core concept in BizTalk which is used for subscription. Basically property promotion writes that particular property's value into the context of the message and also promotes it.

Now there can me many ways to do Property Promotion inside BizTalk Architecture. I have come across three ways to do it. If you guys find out more, do tell me !!!!!

1. Promotion using Schema :

This is pretty simple and every BizTalk developer (New or Experience) must be aware of it. Using Quick promotion will create an Property Schema automatically with the property ID in it.





















2. Promotion using Custom Pipeline component :

Properties can be promoted using Custom Pipeline component using a simple one liner .NET code i.e.


// Promote the MessageType property

string messageType = “http://” + “schemas.demo.com” + “#” + “Request”;
message.Context.Promote(“MessageType”, BTSSystemPropertiesNamespace, messageType);

The Promote() method is used to write the property value into the message context but also sets the property as promoted so that it is available for routing. 


3. Promotion using Correlation (Initializing an correlation set):


We all know we need Correlation set and correlation type inside the Orchestration to create correlation. Correlation set is based on correlation type which is set of properties with some values. When we Initialize a correlation set automatically these properties are promoted in the context of that message. Well one more thing you don't need to follow the correlation set in case you just want to promote the properties. Initializing correlation set won't create an subscription it will just promote the property.

Lets see how to do it :

1. Creating a property schema with the desired property to be promoted















Note: Change its Property Schema Base to MessageContextPropertyBase. By doing this we are creating a custom property to flow with the message context.


2.  Create an simple Orchestration which will receive a message transform it into other message and send the message to File folder.















3. Now create a correlation type selecting the ID property that was created in Property Schema.
















4. Create an correlation set using the above created correlation set and Initialize that set on the send shape.

















5. Other thing to note here is that we need to initialize this property in order to use it further for promotion, so I have just assigned an value to this ID property inside an message assignment shape.


















6. Finally after building, deploying , configuring this application and dropping an sample file at receive location we get the desired output i.e. ID field getting promoted. :)




1 comment:

  1. Thanks for this, a nice elegant and simple way to promote custom properties to the message context.

    ReplyDelete