Property Promotion inside Orchestration

Posted at: 1/8/2007 at 8:02 PM by saravana

Promoting properties inside BizTalk is quite common task, after all back bone of BizTalk's underlying routing infrastructure Publish-Subscribe is based on property promotion. There are tons of articles published in the web explaining this concept.

Properties get promoted within BizTalk at different places, Example: some of the properties gets promoted by Adapters, Pipelines Components, Messaging Engine etc,etc. In custom pipeline components ,developers can use either IBaseMessageContext.Write to write context properties or IBaseMessageContext.Promote to promote context properties. The basic difference between writing and promoting (aka distinguished and promoted) properties are, properties that are written cannot be used for message routing, whereas properties that are promoted can be used for message routing. (There are quite few other important differences, but they are not relevant for this article).

Orchestration:

The syntax for promoting properties within Orchestration is

Message(PromotedPropertyName) = value;

Example

MSG_OUT_PERSON(HTTP.ContentType) = "text/xml";

this is the only direct option available within an orchestration to promote a property. Properties promoted by this method are written rather than promoted. That means it can't be used for message routing (filter expressions in Send Port, Orchestration etc).

The sample code contains an orchestration named "PromoteProperty.odx" as shown in below figure, it just receives a message, does property promotion inside the message assignment stage and send the message out.

The following two lines are present inside the "Message Assignment" shape:

MSG_OUT_PERSON = MSG_IN_PERSON;
MSG_OUT_PERSON(PropertyPromotionInsideOrchestration.PropertySchema.ID) = "SK007"

If you look at the outgoing message context, it will look like as shown in figure below, and you can see clearly the property is "NOT PROMOTED"

So, how can you promote property within Orchestration for routing:

Orchestration got the concept of Correlation, basically which routes the response messages to the correct running orchestration instance that initiated the request message. Within Orchestration we use Correlation Set and Correlation type to archive this type of instance routing.

Correlation type is nothing but a set of Properties, Example in our case it's "ID" (you can have multiple properties together to form a single correlation type, Example EmployeeId, EmployeeCompany).

Correlation Set is based on Correlation type and its a set of properties with specific values. When we "Initialize a Correlation set" within orchestration, the orchestration instance automatically promotes those properties in Correlation set into the message context.

We can use this mechanism to promote propeties (rather than just writing properties), there is no need to do a follow up of the Correlations sets we initialized, and it NOT going to create unnecessary subscriptions. (In simple terms you create correlation sets, not for correlation but for property promotion.)

The sample code contains an Orchestration called "PromotePropertyUsingDummyCorrelationSet.odx" which is exact replica of our first Orchestration "PromoteProperty.odx", with one addition. I added a Correlation Type, Correlation Set and Initialized the Correlation set in the Send shape as shown in below figures.

      

Now, if you look at the outgoing message context , it will look like as shown in figure below. Now you can see ID property is PROMOTED. The attached sample clearly explains this concept. Read the Download section for details.

David Hurtado highlighted this trick on his blog. I expanded his trick with proper sample and more explanation, so that it will be helpful to some one in the future. Or atleast to me if in case I can't remember.

Download:

The download contains the complete source code, sample messages, File drop folders and binding file. Follow the steps to setup the sample.

1. Extract "PropertyPromotionInsideOrchestration" solution to "C:\BTSSamples" folder

2. Open it in Visual Studio, Build/Deploy it, it will create a Biztalk Application called "PropertyPromotionInsideOrchestration". Rectify the errors if something pops up.

3. Open Biztalk 2006 Administration console, right-click on the application "PropertyPromotionInsideOrchestration" and import the binding file "binding.xml". (Start the application).

Execution:

1. Drop the message "NoPromotion.xml" into "FileDrop\In" folder, you'll see the output only in "FileDrop\Out" folder.

2. Drop the message "PromotionWillHappen.xml" into "FileDrop\In" folder you'll see the output in both "FileDrop\Out" and "FileDrop\Out.ByID" folder. (Because message is routed via the second send port to this folder by Content based routing.)

Tags: |  Categories: BizTalk General
Actions: Email this article Email | Kick it! | DZone it! | Save to del.icio.us | Technorati Links
Post Information: Permanent LinkPermalink | CommentsComments(28) | Comments RSS

Comments

Tuesday, January 09, 2007 4:19 AM
Saravanan
Saravanan
Hi Saravana, Ur posts are so cool... really enjoyed some of the posts... but didnt gone through all the posts... i noticed that u r from TN...(nandri at the end of ur post)... can you give me your mail id... or plaese reach me at tosaravanakumar@gmail.com
Tuesday, January 09, 2007 10:14 AM
Saravana Kumar
Hi Saravana,
Yeah I'm from TamilNadu, India originally. But now I'm settled and living in UK. I'll send you an reply email soon.
Tuesday, March 06, 2007 1:50 PM
Anonymous
Anonymous
Sadly it is not possible to use this "exploit" inside a Loop Shape.
Reason: a initialising of Correlation set is only once allowed.
I am still looking for a way to work around that little obstacle.... Any suggestions?
Friday, November 09, 2007 4:03 PM
Anonymous
Anonymous
The correlation set can be defined for a scope, so by placing a scope inside a loop, and moving the correlation set to that scope can solve this problem.
Friday, March 28, 2008 2:21 PM
Bembeng Arifin
Hi, You just saved me Smile
Including the context property to the correlation set just make the routing work Smile
Thanks a lot
Tuesday, May 06, 2008 4:49 PM
Anonymous
Anonymous
Thanks for posting this useful article, I am using this for routing a message amount several orchestrations. However, I have a issue -- When sending fails(e.g the suscriber of the sent-out message is not found), the property promotion fails along with it, it ends up with a dead loop, the same message gets subscribed by the same orchestration again and again. I am curious to know if there is any way to work around this.

Thanks.
Thursday, July 03, 2008 10:49 AM
Naushad Alam
very good post.. and very use full..
Saturday, November 08, 2008 6:36 PM
jenniferzouak
Thanks, you definately saved me some time with this, plus the tip about loops!
Tuesday, April 14, 2009 11:22 AM
Ratnakar India
Ratnakar
Thanks Saravana for this wonderful article. You saved lots of my time and effort. I was really stuck in this. Thanks again!!
Sunday, July 25, 2010 5:45 AM
how to write an outline for an essay
That is some inspirational stuff. Never knew that opinions could be this varied. Thanks for all the enthusiasm to offer such helpful information here.
Monday, August 02, 2010 12:57 AM
lenen
U wilt geld lenen zonder BKR toetsing? De opties hiervoor worden groter, kijk verder en ontdek hoe u wél geld kunt lenen, snel & eenvoudig.
Monday, August 02, 2010 2:53 AM
lenen
Lenen zonder BKR toetsing gaat vandaag heel gemakkelijk. Binnen een paar uur geld lenen zonder BKR toetsing doet u hier, lees snel verder
Thursday, August 05, 2010 1:43 AM
Seattle Limousines
You really know your stuff... Keep up the good work!
Saturday, August 07, 2010 3:51 PM
Camgirls
Your post really made me think, have you any further reading you would recommend?
Saturday, August 07, 2010 4:19 PM
Cam Girls
Established you being a fave so I'll; be back again
Tuesday, August 10, 2010 12:24 AM
hypotheek
Bereken zelf uw hypotheek. Hypotheek berekenen? Maak snel een indicatieve berekening van het maximale leenbedrag van uw hypotheek.
Tuesday, August 10, 2010 7:51 AM
hypotheek
Bereken zelf uw hypotheek. Hypotheek berekenen? Maak snel een indicatieve berekening van het maximale leenbedrag van uw hypotheek.
Friday, August 13, 2010 12:33 AM
lilBenjamin
nice work indeed Laughing
Saturday, August 14, 2010 7:45 AM
Joy United States
Joy
Hmm.!.. it is a post I'm willing to take a bullet for. Undoubtedly hits the mark. I have some minor concerns but I don't want to begin a long post and someone could possibly flame me. Just wish to keep this blog civil and clean. Wouldn't like any hatemail would i? lol Keep it up!
Tuesday, August 17, 2010 10:18 PM
detectoare
nice work indeed Laughing
Sunday, August 29, 2010 3:46 AM
Tamiko Bultman
I can not believe it. I had been just telling my good friend about this. I'll need to share this to him.
Sunday, August 29, 2010 9:05 PM
fiber cement siding
Sunday, August 29, 2010 9:14 PM
spokane roofing solutions
Sunday, August 29, 2010 9:21 PM
post falls siding
Sunday, August 29, 2010 9:30 PM
spokane roofers
Monday, August 30, 2010 6:00 AM
Carl
I do agree with this post. I've also been correcting people who believed the opposite thing.
Tuesday, August 31, 2010 7:41 AM
Gravura Bucuresti
Hey everyone. Interesting idea for a blog. I have been checking out a lot of blogs and forums recently. Some are really informative some are entertaining and some are a real crack up. I've got to admit it, good job on this blog, I'll be sure to look in again real soon.
Wednesday, September 01, 2010 11:57 AM
statistics about homework
That is some inspirational stuff. Never knew that opinions could be this varied. Thanks for all the enthusiasm to offer such helpful information here.

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading