How Your WCF Service Can Use MSMQ as a Durable Message Store
Adding MSMQ to your WCF-based service adds complexity, but any challenges from that complexity are greatly outweighed by the benefits.
by Steve Stefanovich
April 17, 2009
y previous DevX article "WCF and MSMQTake a Message" explained the benefits of introducing queues into an application architecture. Queues provide a useful isolation layer between a service and a caller (or vice-versa) and become a place for messages to live while waiting to be processed. To summarize that article, when queues are used properly they can:
Increase application robustness, because clients can send messages even when services are not running
Increase application scalability, as multiple service instances can be used to process messages from a single queue
Improve client responsiveness, thus eliminating the need for clients to wait on a response from the service
Reduce dependencies between client and services, because all communication is indirect via queues
Ensure the durability of messages, because they can survive service and system failures
Through the MsmqIntegrationBinding and NetMsmqBinding bindings, Windows Communication Foundation (WCF) has baked-in integration with Microsoft Message Queuing (MSMQ), which makes building applications simple. The following are the two solutions for which you can utilize the integration between WCF and MSMQ:
A WCF client application can communicate with an existing MSMQ-based application using the MsmqIntegrationBinding binding. In essence, a WCF-based client can be used to place messages directly into an MSMQ queue. The client can then be processed by another application (referred to hereafter as a service for the sake of simplicity).
A WCF service or client can use an MSMQ queue as a message store via NetMsmqBinding. The WCF endpoints are unchanged; the key differentiator being messages are placed into queues to await processing rather than being sent directly into the WCF runtime.
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!