Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Error Queue Name when using EasyNetQ for RabbitMQ?

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.

like image 821
marcusstarnes Avatar asked Feb 24 '15 12:02

marcusstarnes


1 Answers

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";
like image 54
Wiebe Tijsma Avatar answered Nov 19 '22 23:11

Wiebe Tijsma