The Send method sends a message to the specified queue.
object.Send (DestinationQueue, [Transaction])
Syntax Element | Description |
---|---|
object | Message to be sent. |
DestinationQueue | Reference to destination queue object. |
Transaction | Optional. An MSMQTransaction object or one of the following constants: MQ_NO_TRANSACTION: Specifies that the call is not part of a transaction. MQ_MTS_TRANSACTION: Default. Specifies that the call is part of the current MTS (Microsoft Transaction Server) transaction. MQ_SINGLE_MESSAGE: Sends a single message as a transaction. MQ_XA_TRANSACTION: Specifies that the call is part of an externally coordinated, XA-compliant transaction. |
Each MSMQ message can have no more than 4 MB of data.
To get the handle of a queue, use the Handle property of the queue.
To save a copy of the message in a machine journal, set Journal to MQMSG_JOURNAL. For information on machine journals, see Journal Queues.
Non-transaction messages that do not reach their destination can be sent to a dead letter queue by setting the message's Journal property to MQMSG_DEADLETTER (transaction messages are automatically sent to the transaction dead letter queue on the source machine). For information on dead letter queues, see Dead Letter Queues.
The pTransaction parameter can be set to an MSMQTransaction object or one of the constants described above. For information on the different types of transactions the MSMQ supports, see:
For an example of…. | See… |
---|---|
Sending a String | Sending a String in a Message |
Sending a Date | Sending a Date in a Message |
Sending a Currency | Sending a Currency in a Message |
Sending a number | Sending a Number in a Message |
Sending an array of bytes | Sending an Array of Bytes in a Message |
Sending a persistent object | Sending a Persistent Object |
Sending a ADO recordset | Sending a Data Recordset_in_a_message |
Windows NT: Requires version 4.0 SP3 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mqoai.h.
Import Library: Use mqoa.lib.
Unicode: Defined only as Unicode.
Body, Close, Create, Label, MSMQMessage, MSMQQueue, MSMQQueueInfo, Open, PathName