Tutorial: Using Message Context Properties
This tutorial demonstrates how to use BizTalk Server context properties to set TIBCO Enterprise Message Service (EMS) message descriptor fields in your orchestration. The tutorial assumes that you have an orchestration that receives a message from a receive port and sends the message to a send port bound to Microsoft BizTalk Adapter for TIBCO Enterprise Message Service.
The following procedure demonstrates how to change the priority of the TIBCO EMS message by changing the value of the TibcoEMS.Priority context property. In BizTalk Server, messages are immutable. Therefore, to change a property value, you must create and modify a new message. You create and modify the new message by inserting a message assignment shape between the Receive and Send shapes. First, however, you must reference the schema DLL to gain access to the TIBCO EMS properties.
Open Solution Explorer in Visual Studio.
Right-click References, and select Add Reference.
The Add Reference dialog box appears.
Click the Browse tab.
The Select Component dialog box appears.
Locate <TIBCO EMS_Adapter_installation_directory>\bin, and then select Microsoft.Adapters.TibcoEMSProperties.dll.
The DLL appears in the Selected Components in the Add Reference dialog box.
Click OK and then double-click your orchestration to access the Orchestration Designer.
On the View menu, point to Other Windows, and then click Orchestration View.
In the Orchestration view, right-click Messages and select New Message.
Edit your new message properties and assign a Message Type.
You will assign Message_1 to Message_2. Therefore, you must assign the same message type to both messages.
On the View menu, click Toolbox.
Drag a Message Assignment shape onto your orchestration where you want to create a new message.
Edit the outer ConstructMessage_1 shape and select your new message, Message_2, in the Constructed Messages property.
Double-click the inner MessageAssignment_1 shape.
The BizTalk Expression Editor appears.
In the BizTalk Expression Editor, type your code.
First copy an existing message and then assign values to message context properties.
The syntax is
Message(property) = value;. For example:
Message_2 = Message_1; Message_2( TibcoEMS.Priority) = 6;
See TIBCO EMS for a list of supported properties that you can use in your custom message.
Click OK to close the BizTalk Expression Editor and save your code.
Click the Send shape and assign the Message to be Message_2.
Verify that the shapes in the rest of the message flow operate on the appropriate message.
Right-click your project in Solution Explorer, and select Build.
Right-click your project and select Deploy.
Select Bind, Enlist, and Start in the BizTalk Explorer to test your orchestration.