aiormq icon indicating copy to clipboard operation
aiormq copied to clipboard

Improve interface of consuming messages

Open akayunov opened this issue 3 years ago • 2 comments

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.

akayunov avatar Aug 26 '22 12:08 akayunov

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

mosquito avatar Aug 26 '22 12:08 mosquito

cool!

akayunov avatar Aug 26 '22 12:08 akayunov