Partager via


Transactional and Nontransactional Messaging

 

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

Sending and receiving applications can indicate that they want to send or retrieve messages within the context of a transaction. Sending or retrieving messages within the context of a transaction is referred to as transactional messaging. Sending or retrieving messages outside the context of a transaction is referred to a nontransactional messaging.

Transactional Messaging

Transactional message is only used when you want to perform several tasks in an atomic way. In this context the term "atomic" means that you want to perform several operations, including non-Message Queuing operations, that will all succeed or all fail. When transactional messaging is used, the sending or receiving application has the opportunity to commit the transaction (all the operations have succeeded) or to abort the transaction (one of the operations failed). When a transaction is aborted all operations are rolled back to the state when the transaction was invoked.

When sending messages within a transaction, all the messages are sent together and in the order they were sent, or they are not sent at all. Message Queuing guarantees that all messages sent within the transaction will arrive exactly once, if they can be delivered, and in the order that they were sent. (Transactional messages cannot be sent to a multicast address.)

When retrieving messages within a transaction, all the messages are removed from the queue or they are placed back in the queue in their original position in the queue. Note that peeking at messages make no sense in the context of a transaction.

Nontransactional Messaging

When nontransactional messaging is used, Message Queuing sends each message as a single operation (this includes sending messages to multiple destinations). This means that there is no guarantee that the messages will reach the destination queue in the order they were sent, not does it mean that the message will only arrive once.

For information on See
Message Queuing transaction support Transactions
The types of transactions available Transaction Types
The confirmation process used when sending messages Transaction Confirmation Process
Important programming issues to consider when using transactions Programming Considerations with Transactions