msmq - MSMQ 事务性消息传递如何工作?

标签 msmq

只是想确认如何将消息发送到远程事务性消息队列。

假设我有两台机器,A 和 B。

机器 A 有一个用于接收消息的事务队列。 Windows 服务监视此队列并对数据执行某些操作(将其保存到 SQL Server)。
机器 B 正在运行需要写入机器 A 上的队列的应用程序。

几个问题:

  • 发送消息时,是否在机器 B 上创建了本地副本,然后再将其传送到机器 A?
    一种。如果是这样,这是默认行为,还是仅在发送“IsRecoverable”属性时才会发生?
    湾队列是事务性的这一事实对这种行为有什么影响吗?
  • 由于我使用的是事务队列,一旦事务提交,数据在哪里?
    一种。是不是坐在本地,等待msmq服务将消息投递到远程队列?
    湾或者消息是否位于远程机器上的队列中?

  • 我在解释文档时遇到问题。在某些地方,我看到描述了存储和转发行为,但我无法理解这是否是事务队列的默认行为,或者我是否需要明确地做一些事情来实现这一点。

    最佳答案

    要了解事务性 MSMQ 的主要内容是,在将消息事务性传输到远程队列时,实际上涉及 3 个不同的事务。

  • 发送方将消息写入本地临时队列。
  • 发送方机器上的队列管理器通过线路将消息传输到接收方机器上的队列管理器。
  • 接收方服务处理队列消息,然后从队列中删除消息。

  • 所以回答你的问题:

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



    是的

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



    默认情况下。这就是所谓的 store and forward .

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



    没有,除非出现故障。

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



    这取决于您指的是哪种交易(见上文)

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



    仅当远程队列不可用时。

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



    如果接收方服务未能成功处理消息(处理程序中有异常),消息将保留在远程队列中。

    关于msmq - MSMQ 事务性消息传递如何工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7650788/

    相关文章:

    c# - 如何从队列中删除消息?

    c# - MSMQ 中的多个队列(性能下降)

    不接受 MSMQ.MSMQQueueInfo 路径名

    .net - 使用 MessageEnumerator RemoveCurrent 我怎么知道我是否在队列末尾?

    .net - 我应该什么时候调用 MessageQueue.EndReceive()?

    c# - 使用 C#/.NET 的电子邮件发送策略

    具有 MSMQIntegrationBinding 的 WCF 不会从队列中获取消息

    windows-services - MSMQ 触发器调用 Windows 服务

    MSMQ 查询特定消息

    Wix 和 MSMQ : MSMQ Detection