Sending Messages to a Queue
A version of this page is also available for
4/8/2010
To send a message to a queue, the sending application
- Opens a queue by name.
- Creates message object.
- Sets attributes such as body, timeout, delivery mode, and response queue name.
- Invokes a send method on the message object passing destination queue as a parameter.
The MQSendMessage function differs from its implementation on the Windows desktop in the ways listed in this topic.
Transactions
Transaction support is limited to a single transaction. The single message transaction orders messages and guarantees only a single delivery of each message.
To guarantee single, in-order delivery, create the queue as transactional and set the pTransaction parameter to MQ_SINGLE_MESSAGE.
Authentication Support
Because the embedded implementation of message queuing does not support authentication, set the PROPID_M_AUTH_LEVEL property to MQMSG_AUTH_LEVEL_NONE.
Sending Messages to Public Queues
The MSMQ service can send messages to public queues on a desktop computer or server through the use of an OutFRS queue. An OutFRS queue is an outgoing queue that points to a Falcon Routing Server (FRS).
The target computer must be a message-queue server capable of routing messages; it cannot be another device or a desktop-independent client.
When a device connects to an OutFRS server, messages from an outgoing OutFRS queue are moved to the server. This server is then responsible for the correct routing of the messages. Windows NT® 4.0 Enterprise Edition, Windows 2000, and Windows XP can act as an FRS.
An OutFRS queue is specified as a direct format name in an OutFRSQueue registry value. However, the queue itself does not need to exist on the server.
The destination queue is included as part of the message address and is specified in the PROPID_M_DEST_QUEUE message property, which supports messages sent to OutFRSQueue.
All administrative responses generated by MSMQ, such as acknowledgements (ACKs) and negative acknowledgements (NACKs), are channeled through an OutFRS queue if a nondirect queue name is specified as an administrative queue for a message.
When a message is sent to an OutFRS queue, PROPID_M_DEST_QUEUE is supported, providing it uses the format name of an actual target queue.
The following properties are not supported and, if specified, return MQ_ERROR_PROPERTY:
- PROPID_M_AUTHENTICATED
- PROPID_M_CONNECTOR_TYPE
- PROPID_M_DEST_SYMM_KEY
- PROPID_M_DEST_SYMM_KEY_LEN
- PROPID_M_ENCRYPTION_ALG
- PROPID_M_HASH_ALG
- PROPID_M_PRIV_LEVEL
- PROPID_M_PROV_NAME
- PROPID_M_PROV_NAME_LEN
- PROPID_M_PROV_TYPE
- PROPID_M_SECURITY_CONTEXT
- PROPID_M_SENDER_CERT
- PROPID_M_SENDER_CERT_LEN
- PROPID_M_SENDERID
- PROPID_M_SENDERID_LEN
- PROPID_M_SENDERID_TYPE
- PROPID_M_SIGNATURE
- PROPID_M_SIGNATURE_LEN
- PROPID_M_XACT_STATUS_QUEUE
- PROPID_M_XACT_STATUS_QUEUE_LEN
See Also
Concepts
MSMQ Application Development
Creating Queues
Receiving Messages from a Queue
Connecting to Another Device
MSMQ COM Support
MSMQ Security