This is one of the fundamental topics when using the Biztalk Server. However, it seems also one of the most ignored. The worst of the solution is of course promoting all the properties by default unless specified otherwise. One of my ex-colleagues just ran into this issue when working on his Biztalk solution. In order to get it right, lets try to understand what the promoted properties really are and how they work.
Basics of Property Promotions
Why would you ever require to promote a property? Isn't it just enough to have it in the message and then read it from there? Well, let's see how this works.
Biztalk provides you with a really smart routing feature that allows the engine to decide where to send which message. For example, If you receive a message with the EmployeePaySlip schema, and it has the approved flag to true, it should be redirected to the Finance system Orchestration for making the payments and to the HR system Orchestration for keeping the records. This built in intelligence for the Biztalk engine allows it to route the messages simply based on some content within the messages.
In order to achieve this, the Biztalk engine obviously needs to understand the fields based on which the routing decisions can be taken. To simplify and optimize this working, Biztalk has introduced the notion of "promoted properties". The Biztalk engine can get easy access to the promoted properties without knowing the entire message and hence it can save loads of time and complexity when dealing with routing. To route a message, the Biztalk engine simply reads its promoted properties and does not care about other contents in the message.
When the message schema is defined, particular fields or attributes can be 'promoted'. When a field or attribute is promoted, an annotation is inserted in the schema that defines the property name and the Xpath within the document where it can be found. It also adds the promoted property to the property schema. Now, a property schema is nothing but a special type of schema within your Biztalk solution that lists all the promoted properties across the schemas in your Biztalk solution.
At runtime, when a message is introduced to Biztalk, the Biztalk engine reads the property schema and then subsequently loads all the promoted properties of the message simply by querying the xpath expression. This way, although the entire message can be large, only the promoted properties are loaded in the memory. These promoted properties can then be used by the engine to perform the routing. The promoted properties are also stored separately in the database for tracking the messages.
When using the promoted properties in your Biztalk solution, there is one simple rule -
- Promote only those properties that are required for routing or tracking
From what we know of them now, it is very easy to figure out why -
- First of all because there is more processing required to find the promoted properties from the message.
- These properties are loaded in the memory, hence having a lot of them can put the system under extreme loads.
- And lastly, they are written to the database for tracking taking up disk space and more CPU cycles.
Hope this clarifies a couple of things related to property promotions.