Request-reply confusion
Hi,
I'm quite new to RabbitMQ (and AMQP).
I'm trying to implement a rather simple communication between two processes, they exchange data in JSON format.
I'm using convertSendAndReceive() for the producer and it works pretty well.
But I'm having trouble with the consumer.
What I'd like to do is to have a POJO having this structure :
Code:
public class Consumer {
OutputObject handleRequest(InputObject obj) {
// Handle the request represented as InputObject here and return an OutputObject as result.
}
}
But I'm confused because even after having read the documentation I haven't found any class/method for doing this.
Should I use plain RabbitTemplate on the consumer side, with receive() and then call send() on the getReplyTo() queue, which lead me to another question : I cannot send a message to a specific queue but has to go through an exchange and a routing key, so how do I send back my response without routing key ?
I've read the documentation as well as the book "RabbitMQ in Action" but could not have an answer to this simple example of RPC.
I've also looked at the spring-amqp source code but found nothing.
I'm sure I've missed something. Can anyone point me to a clear answer to my problem ?
Thanks.
People saying it cannot be done should not interrupt people doing it - Chinese proverb