Building Pub-sub applications using MSMQ

MSMQ version 3.0 supports multicasting through the PGM (Pragmatic Multicasting) protocol in WinXP and W2K3.
You can build simple publisher-subscriber applications using this feature.
Queues can be associated with a Multicast IPAddress. Subscriber applications can listen on these queues for new topics.
Publisher applications can multicast the topics to the multicast IPAddress. All the queues that are associated with the multicast IPAddress will receive the topic.
Subscriber apps can receive the topics from their queues and process them.

1. Both MSMQ and PGM are part of the Operating system. They are a big bang for your buck!.
2. PGM protocol has better reliabiliy than UDP.
3. You can use MSMQ trigger feature if you want to filter topics based on message properties (label for example) without having to write a single line of code.

1. The fact that pub-sub is justapoxed with queue means you cannot publish topics synchronously. This means you might have some disadvantages in some scenarios where you might want
the subscribers have to process the topic and return results back to the publisher.
2. If the publisher and subcribers are on different sub-nets the router should support PGM capabilities.
3. MSMQ doesn't support multicasting transactional messages. This means there is no exactly-once in-order delivery guarantees for these messages. There is a possibility of message loss.

For more information on the MSMQ multicasting feature read the following article on MSDN.

The MSMQ multicasting feature is available through the MsmqIntegration channel in WCF. This allows WCF client applications to multicast messages to a Multicast IPAddress. WCF receiver applications can listen on the queues and process the messages.
For more information on the MsmqIntegration channel please review the WinFX SDK.

WCF doesn't ship with a pub-sub feature in V1, however you can be rest assured that the brightest minds in the WCF team are thinking about it seriously for V2.
This solution will not be one that is juxtoposed with queues for Queueing and Pub-sub are two important but orthogonal pieces of an enterprise software.


Comments (0)

Skip to main content