简体   繁体   English

MSMQ Transactional Message Delivery如何工作?

[英]How does MSMQ Transactional Message Delivery work?

Just wanted to get confirmation on how sending messages to remote transactional message queues works. 只想获得有关如何向远程事务消息队列发送消息的确认。

Suppose I have a two machines, A and B. 假设我有两台机器,A和B.

Machine A has a transactional queue that is used for receiving messages. 机器A具有用于接收消息的事务队列。 A windows service monitors this queue and does something with the data (persists it to a SQL Server). Windows服务监视此队列并对数据执行某些操作(将其保留到SQL Server)。 Machine B is running an application that needs to write to the queue on Machine A. 机器B正在运行需要写入机器A上的队列的应用程序。

A few questions: 几个问题:

  1. When sending the message, is a local copy created on Machine B, before it gets delivered to machine A? 发送邮件时,是否在机器B上创建本地副本,然后才将其传送到机器A?
    a. 一个。 If so, is this behavior by default, or does it only occur when the "IsRecoverable" property is sent? 如果是这样,默认情况下是这种行为,还是仅在发送“IsRecoverable”属性时才会发生?
    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? 它是否在本地,等待msmq服务将消息传递到远程队列?
    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. 在某些地方,我看到描述了存储和转发行为,但我无法理解这是否是事务队列的默认行为,或者我是否需要明确地执行某些操作才能实现这一点。

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. 关于事务性MSMQ的主要理解是,在将消息事务传输到远程队列时实际上涉及3个不同的事务。

  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? 发送邮件时,是否在机器B上创建本地副本,然后才将其传送到机器A?

Yes

If so, is this behavior by default, or does it only occur when the "IsRecoverable" property is sent? 如果是这样,默认情况下是这种行为,还是仅在发送“IsRecoverable”属性时才会发生?

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? 它是否在本地,等待msmq服务将消息传递到远程队列?

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. 如果接收方服务未能成功处理消息(处理程序中存在异常),则消息将保留在远程队列中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM