[rabbitmq-discuss] How to send response back in case of synchronous and asynchronous scenarios?

Rajasekhar P sekhar434145 at gmail.com
Mon Dec 2 14:43:00 GMT 2013


*Synchronous and asynchronous messages request and response -*

1.*Synchronous case - *
I am producing messages (10 requests) to single queue("TestQueue") and at
the consumer end we are able to consume the message from that queue. Code
is as below -

Producer -
amqpTemplate.convertAndSend();

Consumer -
amqpTemplate.receiveAndConvert()

Here, producer expects response for each request, so how can we send
response back to that particular request?

*2 - Asynchronous case - *

Producer -
recordList = (List<Record>)rabbitTemplate.convertSendAndReceive(msg);

Consumer -
Implementing SimpleMessageListenerContainer, where POJO will be listening
to the queue as below -
public List<Record> handleMessage(String msg) {
// something
}

in this case we are getting response and as my understanding this is an
asynchronous approach right? So, here, I am confusing how to send response
back in case synchronous and asynchronous cases? Can anyone please help me
on this.  Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20131202/2f69b5c9/attachment.html>


More information about the rabbitmq-discuss mailing list