Sending and Retrieving Messages within a Transaction

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

The requirements for sending or retrieving messages are based on the type of queue used (transactional or nontransactional) and the queues location (local or remote).

Sending Messages

When using transactions to send messages, the messages can be sent to any transactional queue regardless of where the queue is located. In this case, nontransactional queues cannot be used.

The table below compares transactional and nontransactional send operations with local transactional and nontransactional queues and remote transactional and nontransactional queues.

<No Change>

In MSMQ 3.0, when a message is sent to a nontransactional queue within a transaction or a message is sent to a transactional queue outside of a transaction, the send operation succeeds, but the message is not delivered to the destination queue. If the sending application requests negative acknowledgment messages and specifies an administration queue, Message Queuing returns a negative acknowledgment message of the MQMSG_CLASS_NACK_NOT_TRANSACTIONAL_MSG or MQMSG_CLASS_NACK_NOT_TRANSACTIONAL_Q class, respectively.

In MSMQ 1.0 and MSMQ 2.0, the send operation fails.

Retrieving Messages

When using a transaction to retrieve messages, the queue must be a local transactional queue. You cannot retrieve a message from a remote transactional queue, or from a local nontransactional queue within a transaction.

Note

Message Queuing does not provide support for remote transactional-read operations. However, this same functionality can be achieved by using a transactional read-response application. For a description of this type of application, see Transactional Read-response Applications.

The table below compares transactional and nontransactional receive operations with local transactional and nontransactional queues and remote transactional and nontransactional queues.

<No Change>

Note

Nontransactional receives are allowed from any queue (transactional or nontransactional, local or remote). In particular, a nontransactional receive from a transactional queue is essentially a transaction consisting of a single receive operation.

For information on See
The confirmation process used by Message Queuing Transaction Confirmation Process
An application used to retrieve messages from remote queues when transaction are needed Transactional Read-response Applications
A summary of the different transaction types provided by Message Queuing Transaction Types
Example code of sending message in different transactions Sending Messages in Transaction Examples