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); } }




Reply via email to