Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

Message Queuing provides a single-message transaction that implicitly uses the internal transaction support provided by Message Queuing.

The benefits of this type of transaction include the following:

  • Greater speed, compared to using an external transaction coordinator.

  • Simplified application code.

  • Exactly once delivery without the need to coordinate other activities within a single transaction.

The only difference between sending a non-transactional message and using a single-message transaction is that the destination queue must be a transactional queue, and the Transaction parameter of MSMQMessage.Send must be set to MQ_SINGLE_MESSAGE.

Note:
Each Message Queuing message can have no more than 4 MB of data.
To send a single-message transaction
  1. Declare the objects needed to send a message.

    This example uses a MSMQQueueInfo, MSMQQueue, and MSMQMessageobject.

  2. Call MSMQQueueInfo.Opento open the transactional queue with send access.

  3. Call MSMQMessage.Sendto send the message.

    In this example, the Transactionparameter is set to MQ_SINGLE_MESSAGE.

  4. Call MSMQQueue.Closeto close the queue.

See Also