B
B
beduin012017-10-28 14:42:18
RabbitMQ
beduin01, 2017-10-28 14:42:18

Why does the recipient in RabbitMQ need to specify the name of the queue?

I'm learning RabbitMQ examples . Here we have created an exchange with a fanout type. A queue(s) was attached to it.
Now, in theory, in the recipient, we need to specify only the name of the exchanger and we will be able to receive data from all queues. fanout type.
However, in the example, for some reason, a new queue with a random name is created. And everything works out for her. Where is the logic? Why can't we just get data from the queues we created earlier?
Here's the recipient's code snippet:

channel.exchange_declare(exchange='logs',
                         exchange_type='fanout')

result = channel.queue_declare(exclusive=True)
queue_name = result.method.queue

channel.queue_bind(exchange='logs',
                   queue=queue_name)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question