How does MSMQ Transactional Message Delivery work?
Asked Answered
A

1

8

Just wanted to get confirmation on how sending messages to remote transactional message queues works.

Suppose I have a two machines, A and B.

Machine A has a transactional queue that is used for receiving messages. A windows service monitors this queue and does something with the data (persists it to a SQL Server). Machine B is running an application that needs to write to the queue on Machine A.

A few questions:

  1. When sending the message, is a local copy created on Machine B, before it gets delivered to machine A?
    a. If so, is this behavior by default, or does it only occur when the "IsRecoverable" property is sent?
    b. Does the fact that the queue is transactional have any effect on this behavior?

  2. Since I'm using a transactional queue, where is the data once the transaction commits? a. Is it sitting locally, waiting for the msmq service to deliver the message to the remote queue?
    b. Or Is the message sitting in the queue on the remote machine?

I'm having trouble interpreting the documentation. In some places I see that the store and forward behavior is described, but I'm having trouble understanding whether that is the default behavior with transactional queues or if I need to do something explicitly to get that going.

Acciaccatura answered 4/10, 2011 at 16:4 Comment(0)
M
7

The main thing to understand about transactional MSMQ is that there are actually 3 distinct transactions involved in a transactional transmission of a message to a remote queue.

  1. The sender writes the message to a local temporary queue.
  2. The queue manager on the senders machine transmits the message across the wire to the queue manager on the recipient machine.
  3. The receiver service processes the queue message and then removes the message from the queue.

So in answer to your questions:

When sending the message, is a local copy created on Machine B, before it gets delivered to machine A?

Yes

If so, is this behavior by default, or does it only occur when the "IsRecoverable" property is sent?

By default. This is what is known as store and forward.

Does the fact that the queue is transactional have any effect on this behavior?

No except for when there is a failure.

Since I'm using a transactional queue, where is the data once the transaction commits?

It depends which transaction you mean (see above)

Is it sitting locally, waiting for the msmq service to deliver the message to the remote queue?

Only if the remote queue is not available.

Or Is the message sitting in the queue on the remote machine?

If the receiver service fails to process the message succesfully (there is an exception in the handler) the message will stay on the remote queue.

Maryellen answered 4/10, 2011 at 18:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.