K
K
kondratev-ad2022-01-24 17:20:19
RabbitMQ
kondratev-ad, 2022-01-24 17:20:19

RabbitMQ (MQTT) how to send response message from consumer to publisher?

I'm trying to find information on how to send a response to a publisher. I want to use the MQTT protocol. Is there any way to do this? I need the publisher to send a RabbitMQ message, the consumer receives it, processes it and sends the result of the work back to the publisher`y.

In the AMQP protocol, this is implemented using a remote procedure call (RPC)

Example for AMQP:

result = channel.queue_declare(queue='', exclusive=True)
callback_queue = result.method.queue

channel.basic_publish(exchange='',
                      routing_key='rpc_queue',
                      properties=pika.BasicProperties(
                            reply_to = callback_queue,
                            ),
                      body=request)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexandr M., 2022-02-09
@Makarych90

strange approach. you want to make the buffer link responsible for guaranteed delivery. Maybe look towards kafka, then with this approach?
The essence of the rabbit, from point A the message was thrown into the rabbit, from point B they connected to the rabbit and took the message from the rabbit. The rabbit here simply performs the function of a shelf (they put / took the book away)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question