omer faruk omer faruk - 1 month ago 23x
C# Question

QueueingBasicConsumer is deprecated. Which consumer is better to implement RabbitMq .net client

In the RabbitMQ .NET client,

is deprecated.

They recommend to use
instead. I implemented the
interface for the same way they did and it works well.

However, I am curious to why it is deprecated and why I should use


I think (I might be wrong!) it's done because of performance reasons. QueueingBasicConsumer uses SharedQueue<T> which is basically .NET Queue with locks. In order to handle a delivery, you need to lock on queue, enqueue an item and notify other threads waiting for the queue (Monitor.Pulse).

EventingBasicConsumer doesn't use any queueing mechanism. It simply fires Received (HandleBasicDeliver) event which you need to handle in your code.

As you can see now EventingBasicConsumer has less performance overhead, so it's faster (it should be).