You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Shinta802 <ja...@gmail.com> on 2013/02/21 20:06:46 UTC

Help regarding reading multiple response

I am new to Apache Camel. I need your help w.r.t below scenario.

I am using
template.requestBody("wmq:queue:QUEUENAME?replyTo=QUEUENAME&useMessageIDAsCorrelationID=true&replyToType=Exclusive",reqXML)
to send a request and read a response. 

But I have a scenario where I send a request and get 2 responses at the same
Reply Queue. Is there a way I can have this feature using Apache Camel.

Can you please help me regarding this case.

Regards,
Jagadeesh Sripada



--
View this message in context: http://camel.465427.n5.nabble.com/Help-regarding-reading-multiple-response-tp5727972.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Help regarding reading multiple response

Posted by Willem jiang <wi...@gmail.com>.
It looks like the REQUEST QUEUENAME consumer doesn't know about the replyTo property of the message.
BTW, I think it could be more easy for you to handle the multiple response with lower level JMS API with the correlation id.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Tuesday, February 26, 2013 at 3:29 AM, Shinta802 wrote:

> Hi Willem Jiang,
>  
> Thanks for the reply. I started using the ConsumerTemplate and I am still
> not getting the response back, below is the snippet that I have used.
>  
> ProducerTemplate camelTemplate = context.getBean("camelTemplate",
> ProducerTemplate.class);
> ConsumerTemplate consumerTemplate = context.getBean("consumerTemplate",
> ConsumerTemplate.class);
> camelTemplate.sendBody("wmq:queue:[REQUEST
> QUEUENAME]?useMessageIDAsCorrelationID=true", xe80Req);
> String resp = consumerTemplate.receiveBody("wmq:queue:[REPLY
> QUEUENAME]").toString();
>  
> My camel-context.xml is as following
> <camel:camelContext id="camel-client">
> <camel:template id="camelTemplate" />
> <camel:consumerTemplate id="consumerTemplate"/>
> </camel:camelContext>
>  
> I am not able to get the response
>  
> Thanks,
> Jagadeesh Sripada
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Help-regarding-reading-multiple-response-tp5727972p5728118.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: Help regarding reading multiple response

Posted by Shinta802 <ja...@gmail.com>.
Hi Willem Jiang,

Thanks for the reply. I started using the ConsumerTemplate and I am still
not getting the response back, below is the snippet that I have used.

ProducerTemplate camelTemplate = context.getBean("camelTemplate",
ProducerTemplate.class);
ConsumerTemplate consumerTemplate = context.getBean("consumerTemplate",
ConsumerTemplate.class);
camelTemplate.sendBody("wmq:queue:[REQUEST
QUEUENAME]?useMessageIDAsCorrelationID=true", xe80Req);
String resp = consumerTemplate.receiveBody("wmq:queue:[REPLY
QUEUENAME]").toString();

My camel-context.xml is as following
<camel:camelContext id="camel-client">
	<camel:template id="camelTemplate" />
	<camel:consumerTemplate id="consumerTemplate"/>
</camel:camelContext>

I am not able to get the response

Thanks,
Jagadeesh Sripada



--
View this message in context: http://camel.465427.n5.nabble.com/Help-regarding-reading-multiple-response-tp5727972p5728118.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Help regarding reading multiple response

Posted by Willem jiang <wi...@gmail.com>.
Current camel-jms component doesn't support to get two responses at the same time.
I think you need to do the Correlation yourself, if you use ConsumerTemplate[1] to receive the response in the replay queue.

[1]http://camel.apache.org/polling-consumer.html  

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Friday, February 22, 2013 at 3:06 AM, Shinta802 wrote:

> I am new to Apache Camel. I need your help w.r.t below scenario.
>  
> I am using
> template.requestBody("wmq:queue:QUEUENAME?replyTo=QUEUENAME&useMessageIDAsCorrelationID=true&replyToType=Exclusive",reqXML)
> to send a request and read a response.  
>  
> But I have a scenario where I send a request and get 2 responses at the same
> Reply Queue. Is there a way I can have this feature using Apache Camel.
>  
> Can you please help me regarding this case.
>  
> Regards,
> Jagadeesh Sripada
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Help-regarding-reading-multiple-response-tp5727972.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).