MassTransit with RabbitMQ: When is a message moved to the error queue

安稳与你 提交于 2019-12-10 01:06:52

问题


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

  1. At what point messages are moved to the error queues?
  2. Is there a way to know why a certain message is being moved to an error queue?
  3. Is there any way to move message from error queue to normal queue?

Thank you


回答1:


  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.



回答2:


To add to Travis' answer, During my development I found some other reasons for messages going onto the error queue:

  1. The published message type has no consumer
  2. A SAGA and a consumer are expecting the same concrete message type. Even if you try and differentiate using "Accepts" and ".Selected", both a SAGA and a Consumer should not be programmed to receive the same message type.


来源:https://stackoverflow.com/questions/20514457/masstransit-with-rabbitmq-when-is-a-message-moved-to-the-error-queue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!