<div dir="ltr">Hi Russell,<div><br></div><div>Here is the my listerner POJO , still am getting null response. I didnt do any reply queue/corrID configuration. <br><br><div> // receive messages</div><div><span class="" style="white-space:pre">        </span>public Object handleMessage(String query) {</div>
<div><span class="" style="white-space:pre">                </span>Test test = new Test("Pandit", "Pillai");</div><div><span class="" style="white-space:pre">                </span>return test;</div><div><span class="" style="white-space:pre">        </span>}<br>
<br>Producer - <br><br><div>Test response = (Test)this.rabbitTemplate.convertSendAndReceive(msg);</div><div><span class="" style="white-space:pre">                        </span>System.out.println("Response : " + response);<br><br>Result - <br>
<b>Response : null</b><br></div><br></div></div><div><br></div><div>Could you please help me . Thanks in advance.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 12, 2013 at 7:05 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">You need to return a result from your listener pojo<div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">public Object handleMessage(String msg) </span></div>
<div><font face="arial, sans-serif"><br>
</font></div><div><font face="arial, sans-serif">or</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">public List<Object> </font><span style="font-family:arial,sans-serif;font-size:13px">handleMessage(String msg) </span></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">etc.</font></div><div><br></div><div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Nov 12, 2013 at 3:17 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi Russell,<div>
<br></div><div>Thanks for the support. I have followed the documentation am getting response as null. Below is the producer and consumer code.</div>
<div><br></div><div>PRODUCER - </div><div><br>
</div><div><div>// rabbittemplate</div><div><div>public RabbitTemplate rabbitTemplate() {</div><div><span style="white-space:pre-wrap">                </span>RabbitTemplate template = new RabbitTemplate(connectionFactory());</div><div>
<span style="white-space:pre-wrap">                </span>template.setRoutingKey(this.queueName);</div><div><span style="white-space:pre-wrap">                </span>template.setQueue(this.queueName);</div><div><span style="white-space:pre-wrap">                </span>template.setMessageConverter(new JsonMessageConverter());</div>
<div><span style="white-space:pre-wrap">                </span>return template;</div><div><span style="white-space:pre-wrap">        </span>}</div></div><div><br></div></div><div>String msg = "CUSTOMER1";</div><div><div>Object res = this.rabbitTemplate.convertSendAndReceive(msg);</div>
<div>System.out.println("Message sent :" +msg);</div><div>System.out.println("Response : " + res.toString());</div></div><div><br></div><div>CONSUMER - <br></div><div><br></div><div><div><span style="white-space:pre-wrap">                </span>SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();</div>
<div><span style="white-space:pre-wrap">                </span>container.setConnectionFactory(this.connectionFactory);</div><div><span style="white-space:pre-wrap">                </span>container.setQueueNames(this.queueName);</div><div><span style="white-space:pre-wrap">                </span>container.setMessageListener(new <b>MessageListenerAdapter</b>(new TestMessageHandler(this.queueName), new JsonMessageConverter()));</div>
<div><span style="white-space:pre-wrap">                </span>container.start();</div></div><div><br></div><div><br></div><div><div> // receive messages</div><div><span style="white-space:pre-wrap">        </span>public void handleMessage(String msg) {</div>
<div><span style="white-space:pre-wrap">                </span>System.out.println("Received :" + msg);</div><div><span style="white-space:pre-wrap">        </span>} </div></div><div><br></div><div><div><b>Result - </b></div>
<div>Message sent :CUSTOMER1</div><div>java.lang.NullPointerException</div></div><div><br></div><div><br></div><div>Here, inside handleMessage based on message I want get the results from DB and need to send back. Am confusing how set the response to that client(Producer)?</div>
</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><<snip>></div></div></blockquote></div></div></div></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>