You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kiranreddykasa <ki...@fss.co.in> on 2012/12/10 09:47:45 UTC

Activemq Request reply

Hi 

i m trying to implement request/response with jms but couln't succeed

Here is my route

                                         
from("netty:tcp://10.44.71.133:8003?textline=true&sync=false")
						.to("activemq:personnel.records")
						.process(new Processor() {
							
							@Override
							public void process(Exchange exchange) throws Exception {
							System.out.println("called");
							System.out.println("Received Message :: " + exchange);	
							}
						})
						//.to("netty:tcp://10.44.71.133:8002?textline=true&sync=true")
						.to("stream:out");

This route is working fine ..but if i change the 'sync' option to true in
netty endpoint i m not even able to receive request in the
processor....after 20 secs it's throwing timeout exception.




-----
Regards

kiran Reddy
--
View this message in context: http://camel.465427.n5.nabble.com/Activemq-Request-reply-tp5723817.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Activemq Request reply

Posted by kiranreddykasa <ki...@fss.co.in>.
Thanks claus 


I split the route into two routes.

1 -  from("tcp").to("activemq");

2  - from("activemq").process("processor").to("externaltcp");

It worked.



-----
Regards

kiran Reddy
--
View this message in context: http://camel.465427.n5.nabble.com/Activemq-Request-reply-tp5723817p5723830.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Activemq Request reply

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Dec 10, 2012 at 10:53 AM, kiranreddykasa <ki...@fss.co.in> wrote:
> Ya i have two different tcp endpoints
>
> from("netty:tcp://ip:port?textline=true&sync=true").to("jms").process("processor")
>
> in this route messages are not even received by the processor,
>
> but if i change the 'sync' option to 'false' in netty i m able to receive
> messages in processor
>

Yes if sync=true, then the MEP of the Exchange is set to InOut. (eg
request/reply)
So when you send to JMS, then the MEP is InOut, and the JMS will
expect a reply. So it waits for that. And time out after 20 sec if no
reply message.
If there is a reply message, then Camel continues routing, and goes to
the processor.


>
>
>
> -----
> Regards
>
> kiran Reddy
> --
> View this message in context: http://camel.465427.n5.nabble.com/Activemq-Request-reply-tp5723817p5723823.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Activemq Request reply

Posted by kiranreddykasa <ki...@fss.co.in>.
Ya i have two different tcp endpoints

from("netty:tcp://ip:port?textline=true&sync=true").to("jms").process("processor")

in this route messages are not even received by the processor,

but if i change the 'sync' option to 'false' in netty i m able to receive
messages in processor




-----
Regards

kiran Reddy
--
View this message in context: http://camel.465427.n5.nabble.com/Activemq-Request-reply-tp5723817p5723823.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Activemq Request reply

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Dec 10, 2012 at 10:34 AM, kiranreddykasa <ki...@fss.co.in> wrote:
> Hi
>
> Nope , i m trying to achieve request/reply over tcp and jms.
>

If you want request/reply over JMS. Then you would need a consumer on
the "other side" to pickup the message, process it, and send back a
response message with the matching JMSCorrelationID. Camel will wait
for that reply message using a 20 sec timeout.



> from("tcp").to("activemq").process("someprocess").to("external
> tcp").to("someotherprocess")
>
>
> can i acheive this??
>

Then you have 2 different TCP endpoints. Do you mean that?

Maybe you want this?

from tcp
  to jms
  to process

Then the output from the "to process" will become the response
message, for the tcp endpoint (eg from tcp).


And then you need to have something else that pickup th JMS messages,
process, and send back the corresponding reply JMS message (as
mentioned before).


>
>
>
> -----
> Regards
>
> kiran Reddy
> --
> View this message in context: http://camel.465427.n5.nabble.com/Activemq-Request-reply-tp5723817p5723820.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Activemq Request reply

Posted by kiranreddykasa <ki...@fss.co.in>.
Hi 

Nope , i m trying to achieve request/reply over tcp and jms.

from("tcp").to("activemq").process("someprocess").to("external
tcp").to("someotherprocess")


can i acheive this??




-----
Regards

kiran Reddy
--
View this message in context: http://camel.465427.n5.nabble.com/Activemq-Request-reply-tp5723817p5723820.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Activemq Request reply

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I assume you want to just send the message to the JMS queue using
InOnly (eg not do request/reply over JMS also).
And for that you need to look at the event message eip
http://camel.apache.org/event-message.html

So you can do:
   .to(ExchangePattern.InOnly, "activemq:personnel.records")




On Mon, Dec 10, 2012 at 9:47 AM, kiranreddykasa <ki...@fss.co.in> wrote:
> Hi
>
> i m trying to implement request/response with jms but couln't succeed
>
> Here is my route
>
>
> from("netty:tcp://10.44.71.133:8003?textline=true&sync=false")
>                                                 .to("activemq:personnel.records")
>                                                 .process(new Processor() {
>
>                                                         @Override
>                                                         public void process(Exchange exchange) throws Exception {
>                                                         System.out.println("called");
>                                                         System.out.println("Received Message :: " + exchange);
>                                                         }
>                                                 })
>                                                 //.to("netty:tcp://10.44.71.133:8002?textline=true&sync=true")
>                                                 .to("stream:out");
>
> This route is working fine ..but if i change the 'sync' option to true in
> netty endpoint i m not even able to receive request in the
> processor....after 20 secs it's throwing timeout exception.
>
>
>
>
> -----
> Regards
>
> kiran Reddy
> --
> View this message in context: http://camel.465427.n5.nabble.com/Activemq-Request-reply-tp5723817.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen