Messaging services are one of the most effective and popular mediums to communicate between two machines. It doesn't matter if you're a high-tech developer, a stockbroker, a high-school student, or a businessperson. In some way, you use messaging services. Some of the common messaging services are electronic mail (email), instant messenger services, text messaging via phones, or messaging used in complex distributed applications.
We could easily write a book on messaging itself. In this chapter, we'll give you a brief overview of messaging services and how you can access them in the .NET Framework.
The messaging functionality in the .NET Framework Library is accessible through the System.Messaging namespace. This chapter starts by introducing you to the basics of messaging and the System.Messaging namespace. After that, we'll show you how to use messaging classes to write real-world distributed messaging applications.
So, what is messaging? A message is some data transferred between two machines. These machines can be two computers or other devices such as cell phones. These machines may be attached to each other via the Internet, a local area network, or a wireless network. A message can be a simple text message, a string, some streaming data, some live streaming data, or some complex objects. Messaging is the process of sending and receiving messages from one machine to another.
A message queue is a mediator between two machines. When a sender sends a message, it goes to a queue that holds the message and makes sure the receiver gets the message. A message queue also guarantees the delivery of the message. One of the simplest examples of this is email exchange using Microsoft Outlook. If you have any message in your Outbox, Outlook will try to send it until it leaves. The messaging service that handles message queues in Microsoft Windows is called Microsoft Message Queuing (MSMQ).