<div dir="ltr">Thank you Russell for the response. Still am stuck with achieving above program, could please tell where am failing while doing above code. Below is the code at producer end.<br><br><div><br></div><div><br></div>
<div>CONFIGURATION -</div><div><br></div><div>public RabbitTemplate rabbitTemplate() {</div><div><span class="" style="white-space:pre">                </span>RabbitTemplate template = new RabbitTemplate(connectionFactory());</div><div>
<span class="" style="white-space:pre">                </span>template.setRoutingKey(this.queueName);</div><div><span class="" style="white-space:pre">                </span>template.setQueue(this.queueName);</div><div><span class="" style="white-space:pre">                </span>template.setMessageConverter(new JsonMessageConverter());</div>
<div><span class="" style="white-space:pre">                </span>return template;</div><div><span class="" style="white-space:pre">        </span>}</div><div><br></div><div><span class="" style="white-space:pre">        </span>public ConnectionFactory connectionFactory() {</div>
<div><span class="" style="white-space:pre">                </span>CachingConnectionFactory connectionFactory = new CachingConnectionFactory(</div><div><span class="" style="white-space:pre">                                </span>"localhost");</div><div>
<span class="" style="white-space:pre">                </span>connectionFactory.setUsername("guest");</div><div><span class="" style="white-space:pre">                </span>connectionFactory.setPassword("guest");</div><div><span class="" style="white-space:pre">                </span>return connectionFactory;</div>
<div><span class="" style="white-space:pre">        </span>}</div><div><br></div><div><br></div><div>PRODUCER CODE - </div><div><br></div><div><br></div><div><span class="" style="white-space:pre">                        </span>String corrId = UUID.randomUUID().toString();</div>
<div><span class="" style="white-space:pre">                        </span>String replyQueueName = <b>channel</b>.queueDeclare().getQueue();</div><div><span class="" style="white-space:pre">                        </span></div><div><span class="" style="white-space:pre">                        </span>MessageProperties prop = new MessageProperties();</div>
<div><span class="" style="white-space:pre">                        </span>prop.setCorrelationId(corrId.getBytes());</div><div><span class="" style="white-space:pre">                        </span>prop.setReplyTo(replyQueueName);</div><div><span class="" style="white-space:pre">                        </span>Message message = new Message(query.getBytes(), prop);</div>
<div><span class="" style="white-space:pre">                        </span>Message msg = rabbitTemplate.sendAndReceive(message);</div><div><br></div><div><br></div><div>Is this correct at producer end? Here how to Channel to retrieve reqplyQueueName? Could you please correct me on this and please tell me how to write consumer code to send the result(List of Objects) in JSON format back to that particular request in replyqueue? Thanks in advance.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 8, 2013 at 7:20 PM, Gary Russell <span dir="ltr"><<a href="mailto:grussell@gopivotal.com" target="_blank">grussell@gopivotal.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><a href="http://docs.spring.io/spring-amqp/reference/html/amqp.html#request-reply" target="_blank">http://docs.spring.io/spring-amqp/reference/html/amqp.html#request-reply</a><br>
<div><br></div><div>The simplest is to configure the RabbitTemplate to use a fixed reply queue, with a reply listener, and use one of it's convertSendAndReceive(...) (or sendAndReceive) methods; the template will take care of the correlation.</div>
<div><br></div><div>If you want to do it asynchronously and do your own correlation (get the reply asynchronously on another thread) just use one of the send() methods and wire up a listener container to get the results.<br>
</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Fri, Nov 8, 2013 at 12:36 AM, Rajasekhar P <span dir="ltr"><<a href="mailto:sekhar434145@gmail.com" target="_blank">sekhar434145@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi Team,<div><br></div><div>We are trying to make asynchronous call in RabbitMQ using Spring AMQP, could any one please tell me how to configure <b>replyqueue, correlationId, (properties) </b>using spring amqp?</div>
<div><pre style="background-color:rgb(238,238,238);padding:5px 15px;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;color:rgb(85,85,85);font-size:13px;line-height:18px">
<span style="color:rgb(0,128,128)">String</span> <span style="color:rgb(0,128,128)">corrId</span> <span style="font-weight:bold">=</span> <span style="color:rgb(0,128,128)">java</span><span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">util</span><span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">UUID</span><span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">randomUUID</span><span style="font-weight:bold">().</span><span style="color:rgb(0,128,128)">toString</span><span style="font-weight:bold">();</span>
<span style="color:rgb(0,128,128)"> BasicProperties</span> <span style="color:rgb(0,128,128)">props</span> <span style="font-weight:bold">=</span> <span style="font-weight:bold">new</span> <span style="color:rgb(0,128,128)">BasicProperties</span>
<span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">Builder</span><span style="font-weight:bold">()</span>
<span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">correlationId</span><span style="font-weight:bold">(</span><span style="color:rgb(0,128,128)">corrId</span><span style="font-weight:bold">)</span>
<span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">replyTo</span><span style="font-weight:bold">(</span><span style="color:rgb(0,128,128)">replyQueueName</span><span style="font-weight:bold">)</span>
<span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">build</span><span style="font-weight:bold">();</span>
<span style="color:rgb(0,128,128)">channel</span><span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">basicPublish</span><span style="font-weight:bold">(</span><span style="color:rgb(221,17,68)">""</span><span style="font-weight:bold">,</span> <span style="color:rgb(0,128,128)">requestQueueName</span><span style="font-weight:bold">,</span> <span style="color:rgb(0,128,128)">props</span><span style="font-weight:bold">,</span> <span style="color:rgb(0,128,128)">message</span><span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">getBytes</span><span style="font-weight:bold">());</span>
</pre></div><div><span style="font-weight:bold"><br></span></div><div><span>Thanks in advance.</span></div></div>
<br></div></div>_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com" target="_blank">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br></blockquote></div><br></div>