[rabbitmq-discuss] How to configure reply queue?

Rajasekhar P sekhar434145 at gmail.com
Tue Nov 12 16:23:25 GMT 2013


Hi Russell,

Here is the my listerner POJO , still am getting null response. I didnt do
any reply queue/corrID configuration.

      // receive messages
public Object handleMessage(String query) {
Test test = new Test("Pandit", "Pillai");
return test;
}

Producer -

Test response = (Test)this.rabbitTemplate.convertSendAndReceive(msg);
System.out.println("Response : " + response);

Result -
*Response : null*


Could you please help me . Thanks in advance.


On Tue, Nov 12, 2013 at 7:05 PM, Gary Russell <grussell at gopivotal.com>wrote:

> You need to return a result from your listener pojo
>
> public Object handleMessage(String msg)
>
> or
>
> public List<Object> handleMessage(String msg)
>
> etc.
>
>
> On Tue, Nov 12, 2013 at 3:17 AM, Rajasekhar P <sekhar434145 at gmail.com>wrote:
>
>> Hi Russell,
>>
>> Thanks for the support. I have followed the documentation am getting
>> response as null. Below is the producer and consumer code.
>>
>> PRODUCER -
>>
>> // rabbittemplate
>> public RabbitTemplate rabbitTemplate() {
>> RabbitTemplate template = new RabbitTemplate(connectionFactory());
>>  template.setRoutingKey(this.queueName);
>> template.setQueue(this.queueName);
>> template.setMessageConverter(new JsonMessageConverter());
>>  return template;
>> }
>>
>> String msg = "CUSTOMER1";
>> Object res = this.rabbitTemplate.convertSendAndReceive(msg);
>> System.out.println("Message sent :" +msg);
>> System.out.println("Response : " + res.toString());
>>
>> CONSUMER -
>>
>> SimpleMessageListenerContainer container = new
>> SimpleMessageListenerContainer();
>>  container.setConnectionFactory(this.connectionFactory);
>> container.setQueueNames(this.queueName);
>> container.setMessageListener(new *MessageListenerAdapter*(new
>> TestMessageHandler(this.queueName), new JsonMessageConverter()));
>>  container.start();
>>
>>
>>        // receive messages
>> public void handleMessage(String msg) {
>>  System.out.println("Received  :" + msg);
>> }
>>
>> *Result - *
>> Message sent :CUSTOMER1
>> java.lang.NullPointerException
>>
>>
>> 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)?
>>
>>
>> <<snip>>
>>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20131112/6647bb9b/attachment.htm>


More information about the rabbitmq-discuss mailing list