The upcoming BizTalk Server R2 extends heavily the messaging capabilities of BizTalk Server. Together with the rich messaging engine the WCF adapters and the WCF Line of Business Adapters SDK opens a whole new set of possibilities for developers. However, there is still some overlapping between the messaging features of BizTalk and WCF that developers must understand in order to apply the correct technology to a particular scenario. One of the most interesting scenarios with these characteristics is the interaction with MSMQ for achieving asynchronous and persistent messaging. Since the 2004 release BizTalk Server includes a MSMQ adapter for addressing this type of interaction. Now, with the WCF adapters included in R2 it is possible to use the WCF-NetMsmq and the WCF-Custom adapters for achieving similar scenarios. The question then becomes when to use one option versus the other.
The main difference between two approaches relies on the fact that the MSMQ adapter should be considered for pure MSMQ interaction whereas the WCF adapters should be used for Service Oriented interactions in which MSMQ is used as the persistent mechanism. I tried to put together a simple list that highlights some of these differences.
· Contract-based interfaces: The use of the WCF-NetMsmq adapter makes the Service, Data and Message contracts available to the client at design time. In the case of the MSMQ adapter the clients does not have any type information at design time.
· SOAP based messaging: The WCF-NetMsmq adapter uses SOAP as the encoding mechanism.
· Message based security: The use of the WCF-NetMsmq adapter allows the use of WS-* security protocols for encrypting and signing parts of the SOAP message.
· Other WS-* protocols: Although MSMQ natively addresses some aspects, such as persistent, transactionality and reliability, some WS-* protocols can be used with the WCF-NetMsmq adapter as a complement to MSMQ native features.
· Session based messaging: WCF introduces the concept of a session as a mechanism to group a set of related messages together for processing by a single receiving application. This feature can be leveraged natively by the WCF-NetMsmq adapter.
· Batched messaging: (Do not confuse this with BizTalk batching): Similarly to Session based messaging, the WCF-NetMsmq adapter can take advantage of the TransactedBatchingBehavior WCF behavior to group unrelated messages in a single batch.
· Poison message handling: WCF, and consequently the WCF-NetMsmq adapter, provides a rich set of options for handling poison messages after a message has exceeded the maximum number of delivery attempts to the application