Is rabbitmq bidirectional?

The producer sends rabbitmq messages and the consumer receives messages from rabbitmq, then the consumer sends messages back to the producer through rabbitmq.

Is it possible?

+7
source share
3 answers

Are you trying to implement a system like RPC or just want to know how to send messages in both directions?

The base pipe is unidirectional. You cannot send messages from the consumer to the manufacturer through the same queue that the consumer received messages from the manufacturer.

If you want to send messages in another way, your consumer must also be a producer, and your producer must also be a consumer.

+5
source

Yes, itโ€™s possible, but the producer will also have to listen to the queue on which the client will publish / produce ..., you can send queueName / routingkey (producer) in the first message sent from the producer to the client. Then, after receiving the msg message using the routingkey inside, the client can send msg to the original manufacturer

0
source

The manufacturer needs another queue in order to receive a response from the Consumer, the so-called callback queue. The manufacturer can send a request using reply_to and corre_id. The consumer can then use reply_to as the routing key to indicate the correct callback queue, and Producer can remove the callback queue and match the correlation identifier.

0
source

All Articles