aiormq
aiormq copied to clipboard
Improve interface of consuming messages
suggest to change interface of consuming messages from registering call_back on_message to iterating by some message generator:
something like:
await mq.connect(conf)
await mq.create_channel()
await mq.declare_queue(queue_name)
await self.mq.queue_bind(queue_name, '#')
**async for msg in self.mq.basic_consume(self.on_message, queue_name):**
**'do something with message'**
As example looks at websocket handler in aiohttp.
This library is a low level library. aio-pika is a high level wrapper for this library and provides this interface https://aio-pika.readthedocs.io/en/latest/quick-start.html
cool!