Reputation: 353
I'm trying to write an async RPC client using pika, I'm basing my code on the following example,
http://pika.readthedocs.io/en/latest/examples/asynchronous_publisher_example.html
The problem is that according to pika's RPC blocking example, a RPC call does not use an exchange, however whenever I try to open an exchange using,
self._channel.exchange_declare(self.on_exchange_declareok,
'',
self.EXCHANGE_TYPE)
I get disconnected. Also, if I try to skip the exchange_declare function and jump right into declaring the queue, I get the same result. What is the proper way to approach this?
Upvotes: 2
Views: 3858
Reputation: 26352
You can implement an Async RPC client by adding a background thread that handles the RabbitMQ connection. I have a working example for pika and flask available here.
You also have an a little more elaborate example that is based on my own library available here.
These are obviously still based on the Blocking Connection, but at least they offer an asynchronous solution.
Upvotes: 2