Hi,

Anand, it seems like you have sync set to true for the consumer, thereby
making it a In-Out exchange driven consumer (i.e request/response).

However your producer is set with sync=false thereby making it an in-only.
This will cause the response to fall through the cracks and cause connection
closure on the consumer. This should hopefully fix it for you.

BTW, as Claus mentioned, I am working on a Camel Netty component (coding is
done, currently writing tests and adding SSL support). I will bring it to
the community in the next 2-3 weeks after due testing and cleanup.

Cheers,

Ashwin...


anandsk wrote:
> 
> 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
>>>>
>>>>
>>> 
>> 
>> 
>> 
> 
> 


-----
--- 
Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence 
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
--- 
+1-972-304-9084 (Office) 
+1-972-971-1700 (Mobile) 
---- 
Blog: http://opensourceknowledge.blogspot.com/


-- 
View this message in context: 
http://old.nabble.com/Mina-async-route-not-working-tp27757690p27768427.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to