can I make the producer object to stay around and keep it connected to
external address until a route is shutdown that way we can gurantee no loss
of message?.any thoughts?.


anandsk wrote:
> 
> Sorry this may be a repost. I was wondering if anyone has solved this. I
> can use only one thread for sending messages becuase I can have only
> single TCP connection to external server. I want to be able to send
> multiple requests one after the other without waiting for a response.
> responses need to be processed asynchronously. any solutions for this
> scenario?. 
> Here is one possible solution but I am not sure about the life cycle of
> the mina endpoint, is it possible to loose messages with this solution?. I
> have also written custom component to share same endpoint/receivehandler
> for the producer and consumer. I would like to use below solution or
> variation of it  if there are no problems with it. as you can see below
> solution is very simple compared to writing a custom component.
> also I want to findout if 2.3 or later releases have plans to include a
> component for the typical requirement defined above.
> 
> 
>                 from("file:///test/test/response") 
>                 .convertBodyTo(String.class).threads(1) 
>                
> .to("mina:tcp://localhost:6202?sync=false&textline=true&filters=#listFilters");
>  
>                 
>                 from("vm:response") 
>                 .to("log:+++ reply++++"); 
> 
> public class MessageFilter extends IoFilterAdapter { 
>     @Produce(uri = "vm:response") 
>     ProducerTemplate producer; 
>             @Override 
>             public void messageReceived(NextFilter nextFilter, IoSession
> session, 
>                     Object message) throws Exception { 
>                 if (message instanceof String) { 
>                 producer.sendBody(message); 
>                     } 
>                 
>                 nextFilter.messageReceived(session, message); 
>             } 
>         
> } 
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/async-requests-and-responses-on-a-single-connection-tp28071805p28084993.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to