Open josephbiko opened 6 years ago
I have the same issue. I have edited an example for easier debugging:
import aio_pika
import asyncio
async def main(loop):
connection = await aio_pika.connect_robust("amqp://guest:guest@127.0.0.1/", loop=loop)
queue_name = "test_queue"
# Creating channel
channel = await connection.channel() # type: aio_pika.Channel
# Declaring queue
queue = await channel.declare_queue(queue_name, auto_delete=True) # type: aio_pika.Queue
async for message in queue:
with message.process():
print(message.body)
if queue.name in message.body.decode():
break
await queue.delete() # Exception is raised here
queue = await channel.declare_queue(queue_name, auto_delete=True)
async for message in queue:
with message.process():
print(message.body)
if queue.name in message.body.decode():
break
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
loop.close()
Exception:
aio_pika.pika.exceptions.ChannelClosed: (406, "PRECONDITION_FAILED - queue 'test_queue' in vhost '/' in use")
If I change my example code and use await queue.delete(if_empty=False, if_unused=False)
I have an exception aio_pika.pika.exceptions.ChannelClosed
when I want to declare queue second time
I have the following piece of code
Now everytime the aexit (await self.q.delete()) is reached, i get an ChannelClosed Exception, however, the channel is listed as open right before (Channel._channel._state==2). Am I doing something wrong?