From b25222745b188b318660ec3001bda1dc7e3a4349 Mon Sep 17 00:00:00 2001 From: MaPePeR Date: Sun, 28 May 2023 14:25:48 +0200 Subject: [PATCH] Keep the queue name as `hello` until it is redefined in durability section. --- docs/source/rabbitmq-tutorial/2-work-queues.rst | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/source/rabbitmq-tutorial/2-work-queues.rst b/docs/source/rabbitmq-tutorial/2-work-queues.rst index bb2e70a8..934db933 100644 --- a/docs/source/rabbitmq-tutorial/2-work-queues.rst +++ b/docs/source/rabbitmq-tutorial/2-work-queues.rst @@ -166,6 +166,13 @@ from the worker, once we're done with a task. print(" [x] Done") await message.ack() +.. code-block:: python + + # Declaring queue + queue = await channel.declare_queue("hello") + # Start listening the queue with name 'hello' + await queue.consume(on_message) + or using special context processor: .. literalinclude:: examples/2-work-queues/tasks_worker.py @@ -208,9 +215,9 @@ Two things are required to make sure that messages aren't lost: we need to mark First, we need to make sure that RabbitMQ will never lose our queue. In order to do so, we need to declare it as *durable*: -.. literalinclude:: examples/2-work-queues/tasks_worker.py - :language: python - :lines: 23-26 +.. code-block:: python + + queue = await channel.declare_queue("hello", durable=True) Although this command is correct by itself, it won't work in our setup.