问题描述
与其让我未处理的异常进入 EasyNetQ_Default_Error_Queue,我想知道是否有一种方法可以明确说明应该用于给定应用程序的错误队列的名称,因此错误不会t 全部都在这个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 (or just create your own implementation of it and register that as a dependency):
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 for RabbitMQ 时自定义错误队列名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!