Sending and Retrieving Messages within a Transaction
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).
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.
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.
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.
|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.
|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
An application used to retrieve messages from remote queues when transaction are needed
A summary of the different transaction types provided by Message Queuing
Example code of sending message in different transactions