Custom Error Queue Name when using EasyNetQ for RabbitMQ?
Asked Answered
E

1

10

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.

Enki answered 24/2, 2015 at 12:52 Comment(0)
A
13

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

This should probably work:

var bus = RabbitHutch.CreateBus("host=localhost");
bus.Advanced.Container.Resolve<IConventions>().ErrorExchangeNamingConvention = info => "MyExchangeNaming";
bus.Advanced.Container.Resolve<IConventions>().ErrorQueueNamingConvention = () => "MyErrorQueueNaming";
Aurum answered 25/2, 2015 at 10:28 Comment(1)
Thanks Zidad. Works great. My only issue after doing this is now: #28739183Enki

© 2022 - 2024 — McMap. All rights reserved.