I have looked over async. but I have to use only one connection and message receive order is not gauranteed, I am thinking it is possible to have syncrnization issues or message receive starvation issue and timeout on a message. in the end I loose messages?.
willem.jiang wrote: > > I don't think current mina producer can do the work that you want. > But if you take a look at the Camel 2.x Async[1], and > JettyHttpProduer[2], you can find a way to implement the async request > and response with Camel. > > [1] http://camel.apache.org/async.html > [2] > https://svn.apache.org/repos/asf/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java > > Willem > > anandsk wrote: >> Thanks for response,I beleive it's same behavior in camel mina 2.0 and >> 2.2. >> we are thinking of using 2.0M2 as we have release in a month. But my main >> question is how do I keep this producer object/component alive till a >> route >> is shutdown so that I don't loose any messages. any thoughts on solution >> below, i know it is not elegant as I am using filter to capture the >> replies >> from external server but would there be a possibility of loosing messages >> with this approach?. >> also what is the life cycle of a producer/component?. >> >> >> >> >> willem.jiang wrote: >>> I think you can let the producer keep the connection. >>> I just checked the code of camel-mina, the mina producer only close the >>> session if the disconnect option[1] is true (it is new for camel 2.3.0). >>> So please try out the latest Camel 2.3.0-SNAPSHOT for verification. >>> >>> [1]http://camel.apache.org/mina.html >>> >>> Willem >>> >>> anandsk wrote: >>>> 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-tp28071805p28107797.html Sent from the Camel - Users mailing list archive at Nabble.com.