Difference between Message Context PropertyBase and Message Data PropertyBase.
This is one of the most commonly asked Question.
Every field in the property schema will be either of Type MessageContextPropertyBase and MessageDataPropertyBase (Default)
You would have already searched about the difference in MSDN which states, MessageDataPropertyBase should be selected, if the property value is filled by the Data within the Message and MessageContextPropertyBase should be selected, if the property is filled with the Data outside the Message.
So, what is the specific advantage of MessageContextPropertyBase?
Simple answer is, it helps us in preserving the Purity of the Message.
For eg: Assume that you process some Order Messages in your Application. During the Processing, you might encounter some error Messages.
Normally, developers add a new Element to the Order Schema and Try to fill that will Error Messages, which will then be used at later part of Orchestration.
But, this is not a good approach. Schema modifications should not be done for this kind of scenarios. Rather, MessageContextPropertyBase can be effectively used to hold the values associated with every message.
In short, MessageContextPropertyBase Element can be used to hold any kind of Metadata associated with the message which can be used to process the Message.
Sample Application: (To show how it can be used)
1. Create a Simple Schema.
2. Add a Property Schema with an Element and Set the Property Schema Base to MessageContextPropertyBase as shown below.
3. Create a Simple Orchestration. Add a Receive Shape to Receive the Message (say Message_1) of Type Schema which you created in Step 1.
4. Create a new Message (say Message_2) of the same Type Schema (created in step 1). Add a Message Assignment Shape. Set the Message Constructed to Message_2. Add the following Code.
Note: Modifying a Context Property is Considered as modifying a message and hence Message Assignment Shape should be used.
Now you created a message with a Custom Context Property. You can now use this message anywhere in the Orchestration as shown below.
This Message_2 can even be passed to any Sub Orchestrations and access the Context Property there.
This way MessageContextPropertyBase helps us in retaining the Purity of Message by keeping all the metadata associated with the message as Context Properties.
Points to Consider about MessageContextPropertyBase:
1. These are written to Message Context. They are not promoted. To promote them, you have to do in a Custom Pipeline or pass the message to a send port that Initializes/Follows Correlation with the Correlation Type Set to this Property.
2. Value can be written to this Property in any Pipeline Component using the Simple Method, InMessage.Context.Promote or InMessage.Context.Write
3 Comments »
About This Blog
This blog will have some of the Very Useful Concepts & Common Errors encountered in BizTalk Server Development and Maintenance.
The ideas & solutions posted in this blog may not always be a perfect solution.Obviously it is not possible for every one to master on every thing. There are some things which are learnt through experience and some things by research. I will post all possible references wherever applicable.
This is my personal blog and the ideas, thoughts, solutions mentioned here will be mine and no where related to my Employer.
- Walkthrough Using BizTalk Deployment Framework (BTDF)
- Part 1: ESB ToolKit Itineraries
- All you need to know about Outbound EDI Batching - (BTS 2010 only)
- Indetail About Atomic Scope / Transactions in BizTalk Server
- Walkthrough Using BizTalk Deployment Framework (BTDF) – 2 (Using Environment Specific Binding Files)
- SSIS: Connecting to Oracle using Attunity Connector
- How to check if promoted property value exists before using it? (or) Using Exists Function in BizTalk (or) Missing Property Exception
- Schema Versioning in BizTalk Server
- Walkthrough using BizTalk HL7 Accelerator, Schemas and MLLP Adapter
- Condition based String Concatenation
- 363,069 hits
Unique Visitor Hits
add parameters Admin Console alternative design atomic scope Auto Linking Auto Mapping BAM Portal biztalk BizTalk 2010 BizTalk 2013 BizTalk Deployment Error BizTalk File Adapters BizTalk Mapper BizTalk Orchestrati BizTalk Server Config File biztalk server cross referencing bts_CleanupMsgbox Build Action Call Rules Shape Catching SOAP Faults change the Output file name Convert to Excel Convert to HTML Could not connect to TFS Could not load file or assembly EnvDTE cross reference functoids Custom Headers Debugging Orchestrations Deployment Documentation download visual studio download visual studio SP1 download windows server 2003 dtasp_CleanHMData Envelope Schema etw External assembly not updated get common id get common value id cross reference Install BizTalk Server 2009 Learn BizTalk Server Maps new BizTalk projects non-serializable Object reference not set to an instance of an object orchestration Post Deployment Scripts Post Processing Scripts Pre Deployment Scripts Pre Processing Scripts Project Creation Failed Project Reference Errors publishing orchestration publishing schema redistributable CAB file Reset BizTalk Reset Visual Studio REST restful service Schema not found Scripting Functoids Scripts serializable Splitting XML SQL Receive The directory name is invalid TOM TREE GENERATOR unittesting of schemas value cross reference Views Views not shown wcf WCF Service WCF Service Consuming Wizard
Site infoBizTalk Server Tutorial
Create a free website or blog at WordPress.com.