Let's assume that your company has an order
processing system and the system not only needs to update your
downstream systems, which are internal to your organization, but also
needs to notify a trading partner of the transactions.
Let's assume that when an order is placed, you need to order the
requested product from a supplier to support your zero inventory
objectives. This situation brings about a number of challenges. Assuming
for now that the sending and receiving applications are both BizTalk
Server applications, you first must ensure that the transaction is
completed reliably over inherently unreliable protocols and across
network boundaries and firewalls. This is where the BizTalk Framework
2.0 Reliable Messaging scenarios come into play, as shown in Figure 1.
The BizTalk Framework
specification is an XML specification that allows reliable messaging
over HTTP and other transports. A BizTalk server according to the
definition is a server that implements the BizTalk Framework rules and
schemas for processing messages to provide a reliable Interchange
mechanism over the wire.
In that sense, the
product Microsoft BizTalk Server 2009 is a BizTalk server that
implements the BizTalk Framework 2.0 specification. Of course, having
BizTalk Server 2009 on both sides will allow you to implement reliable
messaging Interchanges and processes with relatively small effort.
Microsoft BizTalk Server
2009 provides custom pipeline components for sending and receiving
BizTalk Framework envelopes. The BizTalk Framework properties are
configured through these pipeline components and can also be updated at
runtime within an orchestration.
Figure 2
shows the required components (channel/ports and pipelines) to
implement an Interchange with BizTalk Framework 2.0. The left side shows
the sender configuration, which consists of a static one-way send port
to send the business document or message and a static one-way receive
port to receive BizTalk Framework 2.0 delivery receipts. The right side
shows the receiver configuration, which contains a static one-way
receive port to receive the message or business document and a dynamic
one-way send port that subscribes (using a filter expression) to the Messagebox for messages that have the property BTS.MessageType with a value of BTF2DeliveryReceipt.
In all four ports, the
BizTalk custom pipeline components are used for receiving (Disassemble)
and sending (Assemble) BizTalk Framework envelopes.
1. BizTalk Framework Assembler and Disassembler Pipeline Components
As mentioned earlier,
BizTalk Server 2009 provides custom pipeline components for BizTalk
Framework envelopes. The pipeline component that must be configured for
messages going out is the Assembler. In our first scenario, only one of
the four ports must be configured.
2. Working with BizTalk Framework Properties Within Orchestrations
In many cases, a business
process orchestration will be implemented in either the send or receive
side of a business process, and it is more suitable to configure the
BizTalk Framework properties there. On top of that, there are properties
that are not accessible as design-time pipeline components. The
orchestration is a suitable place to modify the values of these
properties at runtime.
The following lines of code
show how to assign the values to the property field of the outbound
message. These values can be written within a message assignment
expression and will override any given value set at design time.
//Basic settings for BizTalk Framework Reliable Messaging
msgPSB_ReachEnvelope_Outgoing(XMLNORM.AddXMLDeclaration)=false;
msgPSB_ReachEnvelope_Outgoing(BTF2.IsReliable)=true;
msgPSB_ReachEnvelope_Outgoing(BTF2.svc_deliveryRctRqt_sendBy)=_
vBTFDeliveryReceiptSendBy;
msgPSB_ReachEnvelope_Outgoing(BTF2.svc_deliveryRctRqt_sendTo_address)= _
vBTFDeliveryReceiptAddress;
msgPSB_ReachEnvelope_Outgoing(BTF2.svc_deliveryRctRqt_sendTo_address_type)= _
vBTFDeliveryReceiptAddressType;
//Other settings for BizTalk Framework Reliable Messaging
msgPSB_ReachEnvelope_Outgoing(BTF2.prop_topic)=vBTFDocumentTopic;
msgPSB_ReachEnvelope_Outgoing(BTF2.eps_from_address)=vBTFSourceAddress;
msgPSB_ReachEnvelope_Outgoing(BTF2.eps_from_address_type)=vBTFSourceAddressType;
msgPSB_ReachEnvelope_Outgoing(BTF2.eps_to_address)=vBTFDestinationAddress;
msgPSB_ReachEnvelope_Outgoing(BTF2.eps_to_address_type)=vBTFDestinationAddressType;
msgPSB_ReachEnvelope_Outgoing(BTF2.PassAckThrough)=true;
3. Acknowledgment Verification
One of the easiest ways to
verify the acknowledgment of the messages is to look at the following
SQL tables in the BizTalk Management Database:
btf_message_sender
btf_message_receiver
For outgoing messages, look at the sender table, as shown in Figure 3. If the message was acknowledged, the acknowledged field will be marked with an A.
On the receiver side, look at the receive table. In the table will be the records corresponding to the acknowledged documents.