共用方式為


Retrieving Messages from a Transactional Queue

 

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

Messages can be transactionally retrieved only from a local transactional queue. Messages cannot be retrieved from a remote queue when the call is part of the transaction.

Calling MQReceiveMessage, MSMQQueue.Receive, or MSMQQueue.ReceiveCurrent does not actually remove the message within the transaction. The actual removal is done at some time after MS DTC commits the transaction. When MS DTC returns a successful commit return value, the retrieving application is guaranteed that the messages are removed from the queue. If the transaction is aborted, all retrieved messages are returned to their original place in the queue.

Note

There is no limit to the number of messages retrieved from the queue in a single transaction. However, an application cannot send a message to a queue and then try to retrieve it during the same transaction.

Message in a transactional queue do not have to be retrieved within a transaction. The receiving application can retrieve messages from a transactional queue using nontransactional receive operations.

More Information

For information on See
Sending messages Sending Messages to a Transactional Queue
How messages are placed in the queue Ordering of Messages in a Transactional Queue
Checking for messages lost from the receiving queue Checking for Transaction Boundaries when Receiving Messages
Aborting Aborting the Transaction