Request-Reply Pattern

12 views
Skip to first unread message

R P

unread,
May 3, 2022, 4:00:33 AM5/3/22
to rabbitmq-discuss
Hi, 

I would like to use Reply pattern where I have two RabbitMq clients.
1-> Main Producer, also consumes the response back
2-> Main Consumer, also publish the response

My question is shall i set the,
properties.ReplyTo = callbackQueueName                  ////1
or
properties.ReplyTo = respnse.rpoutingKey                     ///2

and on the consumer side
BasicPublish(exchange,
                        routingKey: ReceivedProperties.ReplyTo,                            ///1
                        ............: )

or

BasicPublish(exchange,
                        routingKey: response.routingKey,                                          ///1
                        ............: ) 


Please let me know on both side which code block shall I use, 1 or 2?
Best,
Reena

Peter

unread,
May 18, 2022, 3:15:31 PM5/18/22
to rabbitmq-discuss
As far as my understand goes routing keys allow producers and consumers to be agnostic of each other. For example consumers can subscribe to an exchange using a routing key that they will receive whenever some producer publishes a message to the exchange using this routing key.

When you have a more direct form of communication where producer and consumer know each other, you don't really need routing keys, but you could indeed simply send the callback queue name to let the consumer reply to.

Depends on your use case!

Op dinsdag 3 mei 2022 om 10:00:33 UTC+2 schreef reenapa...@gmail.com:
Reply all
Reply to author
Forward
0 new messages