次の方法で共有


Ordering of Messages in 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

Message Queuing guarantees that all messages sent to a specific transactional queue will be delivered once and that they will arrive in the order in which they were sent by the transaction. This means that if a single transaction A sends messages A1 and A2 to a queue, the messages will arrive exactly once, and A1 will always arrive before A2.

However, the exact ordering of messages is not guaranteed if two transactions are sending messages to the same queue. If transaction A sends messages A1 and A2 and a second transaction B sends messages B1 and B2, Message Queuing only guarantees that A1 will arrive before A2 and that B1 will arrive before B2. To guarantee that A1 and A2 will arrive before B1 and B2, the application must commit B only after getting a successful return code from A.

When transactional messages are sent from the same machine, all of the messages associated with a given transaction are grouped together. Within each group, the messages are in the order in which they were sent; however, the group of messages is not actually sent to the destination queue until the sending application commits the transaction. As a result, the order of the transactional message groups in the destination queue depends on when the sending application committed the transactions.

<No Change>

When transactional messages are sent from different machines, the messages sent within a specific transaction are still delivered in the order in which they were sent. However there is no single group of transactional messages (as shown above) for each transaction. In this case, messages from transactions A and B could be interleaved in the queue. The diagram below shows one possible ordering of messages from transactions A and B.

<No Change>

For information on See
Sending messages Sending Messages to a Transactional Queue
Retrieving message Retrieving Messages from a Transactional Queue
Checking for messages lost from the receiving queue Checking for Transaction Boundaries when Receiving Messages
Aborting Aborting the Transaction