RabbitMq Rpc:EventingBasicConsumer 或 QueueingBasicConsumer

RabbitMq Rpc: EventingBasicConsumer or QueueingBasicConsumer

tutorials on RabbitMq's site are pretty straight forward, but I noticed that in the Rpc example,开发人员选择使用线程阻塞调用consumer.Queue.Dequeue(),而不是使用EventingBasicConsumer和其他地方使用的事件处理模型。

翻阅current documentation据说

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.

其中 the old documentation (v. 1.5.0) 指出它不受支持

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.

难道是RPC示例没有更新?或者我错过了什么?如果有人指出有关此的一些文档,我将不胜感激。

你说的对,没必要用QueueingBasicConsumeran issue 在 RabbitMQ 教程 repo 中有关于此的内容。

发送a pull request已合并,希望文档尽快更新