使用EasyNetQ的RabbitMQ的时候自定义错误队列名称? [英] Custom Error Queue Name when using EasyNetQ for RabbitMQ?
问题描述
而不是让我未处理的异常进入 EasyNetQ_Default_Error_Queue 我在想,如果有,我可以明确地指出应该用于特定应用的错误队列名称的方式,这样的错误不要 •全部结束了在这其中的 EasyNetQ_Default_Error_Queue
Rather than having my unhandled exceptions go into EasyNetQ_Default_Error_Queue I wondered if there is a way that I can explicitly state the name of an Error Queue that should be used for a given application, so errors don't ALL end up in this one EasyNetQ_Default_Error_Queue?
我可以看到如何指定正常的消息队列的名字,但没有设法找到错误队列名什么。
I can see how to specify regular message queue names but haven't managed to find anything about Error Queue names.
推荐答案
是的,你可以通过覆盖在IConventions代表自定义命名约定对象:
Yes, you can customize the naming conventions by overriding the delegates on the IConventions object:
的https://github.com/EasyNetQ/EasyNetQ/blob/master/Source/EasyNetQ.Tests/ConventionsTests.cs
这或许应该工作:
var bus = RabbitHutch.CreateBus("host=localhost");
bus.Advanced.Container.Resolve<IConventions>().ErrorExchangeNamingConvention = info => "MyExchangeNaming";
bus.Advanced.Container.Resolve<IConventions>().ErrorQueueNamingConvention = () => "MyErrorQueueNaming";
这篇关于使用EasyNetQ的RabbitMQ的时候自定义错误队列名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!