使用 RabbitMQ 的 MassTransit:消息何时移至错误队列 [英] MassTransit with RabbitMQ: When is a message moved to the error queue

查看:45
本文介绍了使用 RabbitMQ 的 MassTransit:消息何时移至错误队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 RabbitMQ 版本 3.0.2 &我在错误队列中看到近 1000 条消息.我想知道

I am using RabbitMQ version 3.0.2 & I see close to 1000 message in Error queue. I want to know

  1. 消息何时移至错误队列?
  2. 有没有办法知道为什么某条消息被移动到错误队列中?
  3. 有没有办法将消息从错误队列移动到正常队列?

谢谢

推荐答案

  1. a) 他们未能反序列化或 b) 消费者抛出异常处理该消息五次
  2. 不是...如果您查看队列中的消息,有效负载标头可能包含注释,但我认为我们没有这样做.如果您打开日志记录(NLog、log4net 等),您应该能够在日志中看到异常.您必须在那时关联消息 ID 以找出确切原因.
  3. 没有通过 MassTransit 的内置方式.主要是因为似乎没有一种很好的通用方法来处理这个问题.每个人都想要一些围绕这个的过程.Dru 确实创建了一个 BusDriver 应用程序(在 主要 MT 源代码库) 可用于将消息移回有问题的交换器.这个默认行为是存在的,所以如果你不投入基础设施来处理它,你至少知道事情已经失败了.
  1. a) they fail to deserialize or b) the consumer throws an exception processing that message five times
  2. Not really... If you peek at the message in the queue, the payload headers might contain a note but I don't think we did that. If you turn logging on (NLog, log4net, etc) you should be able to see the exceptions in your log. You'll have to correlate message ids at that point to figure out exactly why.
  3. There is no built in way via MassTransit. Mostly because there doesn't seem to be a great, generic way to handle this. Everyone wants some process around this. Dru did create a BusDriver app (in the main MT source repo) that could be used to move messages back to the exchange in question. This default behaviour is there so you at least know things have been failing if you don't put in the infrastructure to handle it.

这篇关于使用 RabbitMQ 的 MassTransit:消息何时移至错误队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆