【问题标题】:Custom Error Queue Name when using EasyNetQ for RabbitMQ?使用 EasyNetQ for RabbitMQ 时自定义错误队列名称?
【发布时间】:2015-04-26 02:35:37
【问题描述】:

与其让我未处理的异常进入 EasyNetQ_Default_Error_Queue,我想知道是否有一种方法可以明确说明应该用于给定应用程序的错误队列的名称,因此错误不会t 全部都在这个EasyNetQ_Default_Error_Queue

我可以看到如何指定常规消息队列名称,但没有找到有关错误队列名称的任何信息。

【问题讨论】:

    标签: c# .net rabbitmq message-queue easynetq


    【解决方案1】:

    是的,您可以通过覆盖 IConventions 对象上的委托来自定义命名约定(或者只是创建您自己的实现并将其注册为依赖项):

    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";
    

    【讨论】:

    猜你喜欢
    • 2013-07-05
    • 1970-01-01
    • 2022-08-19
    • 2016-09-18
    • 1970-01-01
    • 2020-03-11
    • 1970-01-01
    • 1970-01-01
    • 2015-05-25
    相关资源
    最近更新 更多