MessageQueue Programming Architecture 

The MessageQueue component uses these portions of the Microsoft .NET Framework namespaces:

Messaging Namespaces

When you add an instance of the MessageQueue component to your Visual Studio project, the system automatically creates the references and import statements you need to access these namespaces and classes. If you are creating your MessageQueue components in code in your Visual Studio project, you need to add a reference to System.Messaging.dll and add a statement to your code importing (in Visual Basic) or using (in C#) System.Messaging. For instructions on adding and removing project references, see How to: Add or Remove References in Visual Studio.

If you are developing your application using the .NET Framework, you need to add a reference to System.Messaging.dll when you compile. You also need to add a statement to your code importing (in Visual Basic) or using (in C#) System.Messaging. For information on including references during compilation, see /reference (Visual Basic) or /reference (Import Metadata) (C# Compiler Options).

Key Programming Elements in the MessageQueue Base Class

You can use the following methods to interact with an instance of the MessageQueue component:

  • Use the Create method to create a new message queue using the path you specify, and use the Delete method to delete an existing queue.

  • Use the Exists method to see whether a particular message queue exists.

  • Use the GetPublicQueues method to locate message queues in your Message Queuing network.

  • Use the Peek or BeginPeek method to look at messages in a particular queue without removing the messages from the queue.

  • Use the Receive and BeginReceive methods to retrieve the message at the front of the specified queue and remove it from the queue.

  • Use the Send method to send a message to the specified queue.

You can view details about your Message Queuing installation by using Server Explorer to look at the messaging server. For more information, see How to: Find Queues in Server Explorer. You can also get detailed information about the configuration of your message queue network by using Message Queuing Explorer, which is installed automatically with Message Queuing.

See Also

Tasks

How to: Add or Remove References in Visual Studio
How to: Create MessageQueue Component Instances

Other Resources

Using Messaging Components