Custom Error Queue Name when using EasyNetQ for RabbitMQ?(使用 EasyNetQ for RabbitMQ 时自定义错误队列名称?)
问题描述
与其让我未处理的异常进入 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 时自定义错误队列名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 EasyNetQ for RabbitMQ 时自定义错误队列名称?


- 使用 rss + c# 2022-01-01
- C# 通过连接字符串检索正确的 DbConnection 对象 2022-01-01
- Windows 喜欢在 LINUX 中使用 MONO 进行服务开发? 2022-01-01
- 在 C# 中异步处理项目队列 2022-01-01
- 是否可以在 .Net 3.5 中进行通用控件? 2022-01-01
- 在 LINQ to SQL 中使用 contains() 2022-01-01
- CanBeNull和ReSharper-将其用于异步任务? 2022-01-01
- 为什么 C# 中的堆栈大小正好是 1 MB? 2022-01-01
- Azure Active Directory 与 MVC,客户端和资源标识同一 2022-01-01
- 带问号的 nvarchar 列结果 2022-01-01