Thursday, October 9, 2008

Using MSMQ with .NET (C#)

Microsoft Message Queuing (MSMQ) technology enables applications to communicate across heterogeneous networks and systems that may be temporarily offline. MSMQ provides guaranteed message delivery, efficient routing, security, and priority-based messaging. Whenever there's need for two or more applications (processes) to send messages to each other without having to immediately know results, MSMQ can be used. It's free and comes with Windows, but is not installed by default. Even though MSMQ is primarily used for asynchronous processing, it can also be used in synchronous messaging scenarios.

MSMQ is an excellent choice for implementing B2B architecture. A very popular way of implementation is; one component will be putting XML messages to the queue, and the another component will be processing these messages by fetching them, one by one. Such a disconnected architecture is very common in enterprise applications.

.NET framework has very good support form MSMQ. There are a number of classes in the System.Messaging namespace. The MessageQueue class has methods for basic queue management - connecting to queue, create/delete queues etc. The Message class encapsulates the actual message - the data to send or receive into a message.

Check the below link for a simple introduction to using MSMQ with C#.

http://www.csharphelp.com/archives3/archive581.html

One more point; once MSMQ installed, it can be managed using the Computer Management console (Message Queuing under Services and Applications).

MSMQ

No comments: