Biztalk Server 2006 : The Biztalk Message

Biztalk Message

First off, I’m going to talk about the Biztalk message from a developer perspective so an understanding of .NET or in fact any OOP fundamentals are a bonus.

The Biztalk message is the container that holds an instantiated object(s) from the Biztalk Message Class. The message object has public properties called context properties (message metadata that can be used by the Biztalk engine to filter messages).  Context properties are added by the receiving adaptor and new properties can be added.  Message fields can be promoted and become properties of the message also. These ‘promoted’ properties are stored in a separate property schema (property bag) that can be loaded into memory when loading the entire message by the message box to speed up message routing. These distinguished or context properties are accessed as properties of an object would be accessed :

Message.MessagePart.Property (e.g. Invoice.Footer.TotalAmount = 90)

Here Invoice is the message object and TotalAmount reflects a promoted field that corresponds to a field in the message schema. This of course makes the field value public so that orchestration components and the message box can ‘see’ the properties.  The other important member of the Biztalk message class (BTXMessage) is the loadfrom() method, which loads the message data into the message class.

Its important to remember that a Biztalk message is immutable and so is incapable of  ‘mutating’ / be changed.  The message is created by the receiving adaptor and can only be changed when ‘copied’ into a new message container using the ‘Construct Message’ shape within the orchestration designer. Construction of a message involves creating a new entry in the message box Database.  Modifications can only occur when you make a new instance of the message and copy the old to the new (OldMessage = NewMessage) via the expression editor. All message properties are copied.

Message Inheritence

Each message created to the message box has a GUID (globally unique identifier) which identifies the message in the message box.  Within an orchestration, biztalk uses .NET classes to represent individual messages (the orchestration itself essentially compiles down into a .NET assembly).  These classes act as a generic wrapper around the underlying message data.

Each message biztalk is derived from the :
Microsoft.BizTalk.XLANGs.BTXEngine.BTXMessage class which ultimatley inherits as follows:

System.Object (The base class for all .NET classes)

When you construct a message in Biztalk you are essentially instantiating a new BTX Message class (and copying the data from the old class to the new one if modifications are required).

Message Types

Biztalk messages types come in 4 flavors and how you assign values and construct messages differs slightly depending on which message type you have chosen to create.  These messages can be single or multipart and can hold Binary, XML or a serialized .NET Class data and the type of message is set in the message properties window within visual studio’s orchestration designer.

a) .NET Classes (single part message on which serialization can be set).

b) Multi-Part messages (each part of a multi part message is exposed via intelli sense  like so: MyMessage.PartA.LoadFrom(“Hello World”))

c) Schema Messages (a single part message so assigning value is done at the message level, not the property (or part) level as there is only one part).

d) Web Message (multi part message used in conjunction with SOAP based web services)


One comment

Leave a Reply

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

You are commenting using your 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