Hi, Thanks for the response. I can use only one thread for sending messages becuase I can have only one TCP connection to external server. if I change sync flag to true then that thread is going to wait till the response comes back before it sends another message right?. I want to be able to send multiple requests one after the other without waiting for a response. responses need to be processed asynchronously.So, I can't set sync flag to true, is there any other solution to my problem. Thanks, Anand
willem.jiang wrote: > > Hi I think you need to change the route like this > > from("mina:tcp://localhost:6202?textline=true&sync=true").process(new > Processor() { > public void process(Exchange exchange) throws Exception { > String body = exchange.getIn().getBody(String.class); > Thread.sleep(30000); > exchange.getOut().setBody("Bye 1" + body); > } > }); > > from("file:///test/test/response") > .convertBodyTo(String.class) > .toAsync("mina:tcp://localhost:6202?sync=true&textline=true",10) > .to("log:+++ reply++++"); > To make sure the mina client can get the right response. > > Willem > > anandsk wrote: >> Thanks. yes, I have seen the examples and I modified my code. but it >> still >> doesn't deliver reply asyncronously. >> I am thinking may be camel Mina's sync option may be conflicting with >> async >> route. Please see my code below. >> >> >> from("mina:tcp://localhost:6202?textline=true&sync=true").process(new >> Processor() { >> public void process(Exchange exchange) throws Exception { >> String body = exchange.getIn().getBody(String.class); >> Thread.sleep(30000); >> exchange.getOut().setBody("Bye 1" + body); >> } >> }); >> >> from("file:///test/test/response") >> .convertBodyTo(String.class) >> >> .toAsync("mina:tcp://localhost:6202?sync=false&textline=true",10) >> .to("log:+++ reply++++"); >> >> >> >> Claus Ibsen-2 wrote: >>> Have you seen the 2 asyncTo examples which are listed here? >>> http://camel.apache.org/examples.html >>> >>> >>> >>> On Tue, Mar 2, 2010 at 5:10 PM, anandsk <sku...@arccorp.com> wrote: >>>> Hi, >>>> I tried this route with camel 2.2 and it is not forwarding response to >>>> end >>>> point defined in async "direct:response". also I see the logs showing >>>> that >>>> mina producer receiving the message back from tcp server but it is not >>>> forwarding them to async endpoint. am I doing this wrong. >>>> >>>> Thanks, >>>> Anand >>>> >>>> from("mina:tcp://localhost:6202?textline=true&sync=true").process(new >>>> Processor() { >>>> public void process(Exchange exchange) throws >>>> Exception { >>>> String body = >>>> exchange.getIn().getBody(String.class); >>>> //Thread.currentThread(); >>>> Thread.sleep(1000); >>>> exchange.getOut().setBody("Bye 1" + body+"\n"); >>>> //exchange.getOut().setBody("Bye 2" + >>>> body+"\n"); >>>> } >>>> }); >>>> >>>> >>>> //from("jms:test.Camel1") >>>> from("file:///test/test/response") >>>> .convertBodyTo(String.class).threads(1) >>>> //.to("log:jms.queue.message") >>>> //.bean(smooks.StatusRequestMessageHandler.class) >>>> //.setHeader(MinaEndpoint.HEADER_MINA_IOSESSION, >>>> expression) >>>> .to("mina:tcp://localhost:6202?textline=true&sync=true") >>>> .toAsync("direct:response",1) >>>> .to("log:direct"); >>>> >>>> from("direct:response") >>>> .to("log:jms.queue.message"); >>>> -- >>>> View this message in context: >>>> http://old.nabble.com/Mina-async-route-not-working-tp27757690p27757690.html >>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>> >>>> >>> >>> >>> -- >>> Claus Ibsen >>> Apache Camel Committer >>> >>> Author of Camel in Action: http://www.manning.com/ibsen/ >>> Open Source Integration: http://fusesource.com >>> Blog: http://davsclaus.blogspot.com/ >>> Twitter: http://twitter.com/davsclaus >>> >>> >> > > > -- View this message in context: http://old.nabble.com/Mina-async-route-not-working-tp27757690p27764563.html Sent from the Camel - Users mailing list archive at Nabble.com.