K
K
keddad2020-04-28 17:26:05
Python
keddad, 2020-04-28 17:26:05

Why does a task sent to the RabbitMQ queue using aio_pika not appear there?

I want to send a message to RabbitMQ. I declare connection:

db.client = await connect("amqp://user:[email protected]_rabbitmq")


Then I use channel. In this case, the queue to which I send the message is declared in advance using the following function:

async def get_rabbitmq_channel(queues_to_declare=None) -> Channel:
    if queues_to_declare is None:
        queues_to_declare = []

    chan = await db.client.channel()

    for q in queues_to_declare:
        chan.declare_queue(q)

    return chan


Then, to send, I do this:

await rabbit_channel.default_exchange.publish(
        Message(
            body=str(
                NewFaceToRabbit(image_id=str(image_id), task_id=task_id, trait_id=str(trait_id.inserted_id),
                                append=append_face).dict()).encode()
        ),
        routing_key="addface" # эта очередь была определена с помощью delcare_queue в функции выше
    )

And nothing. No Exceptions are thrown, but I don't see a message in the addface queue (I'm using Jms Messenger, a plugin for the JetBrains IDE). What am I doing wrong?

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