Share via


Checking for Transaction Boundaries when Receiving Messages

 

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 provides three message properties that can be used by the receiving application to check the transaction boundaries of the messages in a queue. This includes a property that identifies which transaction sent the message, and two properties that indicate if the message was the first or last message sent in the transaction. Together, these three properties can be used to check the transaction boundaries of a transaction issued by a single computer to a single transaction queue.

The receiving application can use these properties to detect if any messages have been lost while they are in the receiving queue.

Note

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 within the transaction. However, Message Queuing cannot guarantee that messages will not be lost after the sending application commits the transaction.

Messages can be lost because of incorrect encryption, failed authentication, insufficient permissions, and time-out events.

For example, the following illustration shows a destination queue with messages from two transactions: transaction A and transaction B (note that the sequence of the messages indicates that the sending application committed transaction A, then committed to transaction B).

<No Change>

If the receiving application finds the first message from transaction B before it finds the last message from transaction A, it knows that at least one message, the last message from transaction A, has been lost. Note that you can only check to see if the first or last message from the transaction was lost.

More Information

For information on See
Sending messages Sending Messages to a Transactional Queue
Retrieving message Retrieving Messages from a Transactional Queue
How messages are placed in the queue Ordering of Messages in a Transactional Queue

Examples

For an example of See
Checking transaction boundaries C/C++ Code Example: Checking Transaction Boundaries

 Visual Basic Code Example: Checking Transaction Boundaries