3

I`m using aio pika version 6.7.1 with python 3.7.7 with rabbitmq 3.8.9.

the consumer looks like the documentations suggests:

        async with connection:
            # Creating channel
            channel = await connection.channel()
            await channel.set_qos(prefetch_count=self.prefetch_count)

            # Declaring exchange
            exchange = await channel.declare_exchange(
                'EX', ExchangeType.TOPIC, durable=True
            )

            # Declaring queue
            queue = await channel.declare_queue(self.queue_name, durable=True)

            # Bind queue to exchange
            await queue.bind(exchange)
            async with queue.iterator() as iter:
               async for message in iter:
                    try:
                       await self.do_stuff_to_message(message)
                       await message.ack()
                    except Exception as e:
                       await self.processor.handle_failure(e, message)

but gets "asyncio.TimeoutError from None" errors - its only solved by removing the await from message.ack().

what is the reason and what is the correct use?

0 Answers0