<div dir="ltr"><div><b>Synchronous and asynchronous messages request and response -</b></div><div><br></div><div>1.<b>Synchronous case -�</b></div><div>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 -�</div>
<div><br></div><div>Producer -�</div><div>amqpTemplate.convertAndSend();</div><div><br></div><div>Consumer -�</div><div>amqpTemplate.receiveAndConvert()�</div><div><br></div><div>Here, producer expects response for each request, so how can we send response back to that particular request?</div>
<div><br></div><div><b>2 - Asynchronous case -�</b></div><div><br></div><div>Producer -�</div><div>recordList = (List<Record>)rabbitTemplate.convertSendAndReceive(msg);</div><div><br></div><div>Consumer -�</div><div>
Implementing SimpleMessageListenerContainer, where POJO will be listening to the queue as below -�</div><div>public List<Record> handleMessage(String msg) {</div><div><span class="" style="white-space:pre">  </span>// something</div>
<div>}</div><div><br></div><div>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.</div>
<div><br></div></div>