Rate This Content
MSDN
MSDN Library
.NET Development
.NET Framework 3.5

  Switch on low bandwidth view

We were unable to locate this content in hi-in.

Here is the same content in en-us.

This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
System.Messaging Namespace

The System.Messaging namespace provides classes that allow you to connect to, monitor, and administer message queues on the network and send, receive, or peek messages.

Members of the MessageQueue class include the following methods for reading and writing messages to the queue:

  • The Send()()() method enables your application to write messages to the queue. Overloads of the method enable you to specify whether to send your message using a Message (which provides detailed control over the information you send) or any other managed object, including application-specific classes. The method also supports sending messages as part of a transaction.

  • The Receive, ReceiveById()()(), and ReceiveByCorrelationId()()() methods provide functionality for reading messages from a queue. Like the Send()()() method, these methods provide overloads that support transactional queue processing. These methods also provide overloads with time-out.

    Out parameters that enable processing to continue if the queue is empty. Because these methods are examples of synchronous processing, they interrupt the current thread until a message is available, unless you specify a time-out.

  • The Peek method is similar to Receive, but it does not cause a message to be removed from the queue when it is read. Because Peek does not change the queue contents, there are no overloads to support transactional processing. However, because Peek, like Receive, reads messages synchronously from the queue, overloads of the method do support specifying a time-out in order to prevent the thread from waiting indefinitely.

  • The BeginPeek, EndPeek(IAsyncResult), BeginReceive, and EndReceive(IAsyncResult) methods provide ways to asynchronously read messages from the queue. They do not interrupt the current thread while waiting for a message to arrive in the queue.

The following methods of the MessageQueue class provide functionality for retrieving lists of queues by specified criteria and determining if specific queues exist:

Other methods of the MessageQueue class provide the following functionality:

  • Creating and deleting Message Queueing queues.

  • Using a message enumerator to step through the messages in a queue.

  • Using a queue enumerator for iterating through the queues on the system.

  • Setting ACL-based access rights.

  • Working with the connection cache.

The Message class provides detailed control over the information you send to a queue, and is the object used when receiving or peeking messages from a queue. Besides the message body, the properties of the Message class include acknowledgment settings, formatter selection, identification, authentication and encryption information, timestamps, indications about using tracing, server journaling, and dead-letter queues, and transaction data.

The MessageQueue component is associated with the following three formatters, which enable you to serialize and deserialize messages sent and received from queues:

  • The XmlMessageFormatter provides loosely coupled messaging, enabling independent versioning of serialized types on the client and server.

  • The ActiveXMessageFormatter is compatible with the MSMQ COM control. It allows you to send types that can be received by the control and to receive types that were sent by the control.

  • The BinaryMessageFormatter provides a faster alternative to the XmlMessageFormatter, but without the benefit of loosely coupled messaging.

Other classes in the Messaging namespace support code-access and ACL-based security, filtering Message properties when reading messages from a queue, and using transactions when sending and receiving messages.

  ClassDescription
Public classAccessControlEntry Specifies access rights for a trustee (user, group, or computer) to perform application-specific implementations of common tasks.
Public classAccessControlList Contains a list of access control entries, specifying access rights for one or more trustees.
Public classActiveXMessageFormatter Serializes or deserializes primitive data types and other objects to or from the body of a Message Queuing message, using a format that is compatible with the MSMQ ActiveX Component.
Public classBinaryMessageFormatter Serializes or deserializes an object, or an entire graph of connected objects, to or from the body of a Message Queuing message, using a binary format.
Public classCursor A Cursor is used to maintain a specific location in a MessageQueue when reading the queue's messages.
Public classDefaultPropertiesToSend Specifies the default property values that will be used when sending objects other than Message instances to a message queue.
Public classMessage Provides access to the properties needed to define a Message Queuing message.
Public classMessageEnumerator Provides a forward-only cursor to enumerate through messages in a message queue.
Public classMessagePropertyFilter Controls and selects the properties that are retrieved when peeking or receiving messages from a message queue.
Public classMessageQueue Provides access to a queue on a Message Queuing server.
Public classMessageQueueAccessControlEntry Specifies access rights for a trustee (user, group, or computer) to perform Message Queuing tasks.
Public classMessageQueueCriteria Filters message queues when performing a query using the MessageQueue class's GetPublicQueues method.
Public classMessageQueueEnumerator Provides a forward-only cursor to enumerate through messages in a message queue.
Public classMessageQueueException The exception that is thrown if a Microsoft Message Queuing internal error occurs.
Public classMessageQueueInstaller Allows you to install and configure a queue that your application needs in order to run. This class is called by the installation utility, for example, InstallUtil.exe, when installing a MessageQueue.
Public classMessageQueuePermission Allows control of code access permissions for messaging.
Public classMessageQueuePermissionAttribute Allows declarative MessageQueue permission checks.
Public classMessageQueuePermissionEntry Defines the smallest unit of a code access security permission set for messaging.
Public classMessageQueuePermissionEntryCollection Contains a strongly typed collection of MessageQueuePermissionEntry objects.
Public classMessageQueueTransaction Provides a Message Queuing internal transaction.
Public classMessagingDescriptionAttribute Specifies a description for a property or event.
Public classPeekCompletedEventArgs Provides data for the PeekCompleted event. When your asynchronous peek operation calls an event handler, an instance of this class is passed to the handler.
Public classReceiveCompletedEventArgs Provides data for the ReceiveCompleted event. When your asynchronous receive operation calls an event handler, an instance of this class is passed to the handler.
Public classSecurityContext Represents the security context for a message in a queue.
Public classTrustee Specifies a user account, group account, or logon session to which an access control entry applies.
Public classXmlMessageFormatter Serializes and deserializes objects to or from the body of a message, using the XML format based on the XSD schema definition.
  InterfaceDescription
Public interfaceIMessageFormatter Serializes or deserializes objects from the body of a Message Queuing message.
  DelegateDescription
Public delegatePeekCompletedEventHandler Represents the method that will handle the PeekCompleted event of a MessageQueue.
Public delegateReceiveCompletedEventHandler Represents the method that will handle the ReceiveCompleted event of a MessageQueue.
  EnumerationDescription
Public enumerationAccessControlEntryType Specifies whether to allow, deny, or revoke access rights for a trustee.
Public enumerationAcknowledgeTypes Specifies the types of acknowledgment message that Message Queuing returns to the sending application.
Public enumerationAcknowledgment Specifies the result of an attempted message delivery.
Public enumerationCryptographicProviderType Specifies the cryptographic service providers available for validating digital signatures.
Public enumerationEncryptionAlgorithm Specifies the encryption algorithm used to encrypt the message body of a private message.
Public enumerationEncryptionRequired Specifies the privacy level of messages received by the queue.
Public enumerationGenericAccessRights Uses the Windows 2000 and Windows NT access format to specify a set of common access rights that Message Queuing maps to both standard and object-specific access rights for reading, writing, and executing.
Public enumerationHashAlgorithm Specifies the hash algorithm used by Message Queuing when authenticating messages.
Public enumerationMessageLookupAction Specifies a message to peek at or receive from a message queue.
Public enumerationMessagePriority Specifies the priority Message Queuing applies to a message while it is en route to a queue, and when inserting the message into the destination queue.
Public enumerationMessageQueueAccessRights Specifies a set of object-specific access rights for operations specific to Message Queuing.
Public enumerationMessageQueueErrorCode Identifies the source of an error that occurred within the Message Queuing application and generated a MessageQueueException exception.
Public enumerationMessageQueuePermissionAccess Defines access levels used by System.Messaging permission classes.
Public enumerationMessageQueueTransactionStatus Specifies the state of an internal Message Queuing transaction.
Public enumerationMessageQueueTransactionType Specifies the type of a Message Queuing transaction.
Public enumerationMessageType Identifies the type of a message. A message can be a typical Message Queuing message, a positive (arrival and read) or negative (arrival and read) acknowledgment message, or a report message.
Public enumerationPeekAction Indicates whether to peek the current message in a queue, or the next message.
Public enumerationQueueAccessMode Specifies the access mode for a MessageQueue at creation time.
Public enumerationStandardAccessRights Specifies a set of standard access rights that correspond to operations common to most types of securable objects.
Public enumerationTrusteeType Specifies the type of a trustee.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker