Delen via


Message Queuing Transactions

 

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 following illustration shows how transactions are used by sending and receiving applications. In this model, Message Queuing uses two transactions: one to send messages to a destination queue and the other to retrieve messages from the queue.

<No Change>

In this model, the sending application can commit a sending transaction that sends messages to the destination queue, and the receiving application can commit a receiving transaction that retrieves the messages from the destination queue. If the sending transaction succeeds, the messages are placed in an outgoing queue on the source computer, and then a best effort is made to delivery them to the destination queue.

Note

When receiving an error from a call to commit a transaction, the transaction is in doubt; it may or may not have been committed.

When more than one message is sent within a transaction, Message Queuing uses an internal exactly-once-delivery (EOD) protocol to guarantee that the messages will be delivered exactly once and in order. Information is attached to each transactional message that allows the destination queue manager to discard duplicate and out-of-order messages. This information includes a sequence identifier that identifies the stream of messages sent within a single transaction. In addition, each message within the stream carries a sequence number identifying the message in the stream and a previous number identifying a preceding message in the same message stream. A message can be delivered only if a message whose sequence number is equal to the previous number is present in the destination queue. The first message in a stream always carries a previous number equal to zero.

When a message is placed in the destination queue, the destination queue manager acknowledges its arrival by sending an order acknowledgment message containing its sequence number back to the source computer. This number indicates to the source queue manager that all messages in the message stream up to the acknowledged message were accepted.

In addition, Message Queuing provides its own transaction confirmation process to inform the sending application either that the messages were retrieved from the queue or why the receiving application failed to retrieve them. Note that this confirmation process is completely independent of committing the transaction.

Additional information about the ultimate outcome of message sending operations becomes available when applications request positive and negative acknowledgment messages. For more information on requesting acknowledgment messages, see Acknowledgment Messages.

Note

A single transaction may not include sending a message to a destination queue and receiving the same message from the queue. However, a single transaction may include calls to receive a message from a queue and to send a message to a destination queue.

More Information

For information on See
The transaction confirmation process used by Message Queuing Transaction Confirmation Process
Requirements for sending or receiving messages within a transaction Sending and Retrieving Messages within a Transaction
An application used to retrieve messages from remote queues when transactions 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