Use rabbitmq direct reply-to for RPC calls #69
Replies: 5 comments 16 replies
-
@bodograumann thanks for notice that
It is exactly how RabbitMQ implements Direct Reply-To feature.
Queues, declared as |
Beta Was this translation helpful? Give feedback.
-
Wait: you can't use |
Beta Was this translation helpful? Give feedback.
-
Also, please do not use RPC to testing. It's a production feature. |
Beta Was this translation helpful? Give feedback.
-
@bodograumann thanks for your help. RPC over MQ become better by you. |
Beta Was this translation helpful? Give feedback.
-
Well, now we have another problem: miltiple consuming from reply_to is forbidden. So, RPC request is blocked by another request... |
Beta Was this translation helpful? Give feedback.
-
The use case of RPC over MQ is very interesting, especially for testing purposes.
Looking at the code, it seems a dedicated reply queue is created for each request.
I think that we can avoid that by using an existing reply queue or (at least for RabbitMQ) by using the Direct Reply-To feature.
Implementing it should be simple.
broker.publish
already accepts areply_to
argument and it is currently applied to the message.Now if both
callback=True
andreply_to
are set, we could avoid creating a dedicated reply queue and use the one fromreply_to
.In particular
broker.publish(queue=…, callback=True, reply_to="amq.rabbitmq.reply-to")
would be using the Direct Reply-To feature of RabbitMQ.At the moment, when using
callback
andreply_to
at the same time, the latter would override the former, but propan would still be waiting for a reply on the anonymous reply queue it created internally. So the reply can never be received in this situation.I also noticed that the
callback_queue
is currently not deleted. This should probably be added as well, when it is created internally. (When given by the user viareply_to
it should be kept of course.amq.rabbitmq.reply-to
isn't even a real queue and cannot be deleted.)Beta Was this translation helpful? Give feedback.
All reactions