pardahlman
pardahlman

Reputation: 1454

RabbitMq Rpc: EventingBasicConsumer or QueueingBasicConsumer

The tutorials on RabbitMq's site are pretty straight forward, but I noticed that in the Rpc example, the developers choose to use the thread-blocking call consumer.Queue.Dequeue() instead of using the EventingBasicConsumer and the event handling model used elsewhere.

Looking through the current documentation it is stated that

As of version 3.5.0 application callback handlers can invoke blocking operations (such as IModel.QueueDeclare or IModel.BasicCancel). IBasicConsumer callbacks are invoked concurrently.

Where as the old documentation (v. 1.5.0) states that it is not supported

Application callback handlers must not invoke blocking AMQP operations (such as IModel.QueueDeclare or IModel.BasicCancel). If they do, the channel will deadlock. [...] For this reason, QueueingBasicConsumer is the safest way of subscribing to a queue.

Could it be that the RPC example hasn't been updated? Or am I missing something? I would very much appreciate to be pointed to some documentation about this.

Upvotes: 7

Views: 2955

Answers (1)

olsh
olsh

Reputation: 463

You're right, there is no need to use QueueingBasicConsumer. There is an issue in RabbitMQ tutorials repo about this.

I've sent a pull request and it was merged, hope the documentation will be updated soon.

Upvotes: 3

Related Questions