I think the server just close the connection when there is no further 
conversion for a long time.
It’s hard for the client or server to tell if the connection is still open 
until write the message to the socket. Can you introduce some ping message to 
keep the TCP connection alive?

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 4, 2015 at 12:45:07 AM, sykomaniac (ashleysyke...@gmail.com) wrote:
> Hi,
>  
> I'm using Camel to pull a message from a queue and send it to a remote
> server using MINA2. I've configured the endpoint like so:
>  
> String endpoint = baseEndpoint.copy()
> .setQueue(entry.Route + "." + entry.Party + ".#")
> .setRoutingKey(entry.Route + "." + entry.Party + ".#")
> .setExclusive(true)
> .build();
>  
> //Build outgoing TCP settings
> minaComp.setCamelContext(getContext());
> Mina2Configuration minaCfg = new Mina2Configuration();
> minaCfg.setProtocol("tcp");
> minaCfg.setCodec(new HL7MLLPCodec());
> minaCfg.setHost(entry.IP);
> minaCfg.setPort(entry.Port);
> minaCfg.setSync(true);
> minaCfg.setLazySessionCreation(true);
>  
> from(endpoint)
> .autoStartup(entry.ConnectionStatus ==
> InterfaceStatus.Up)
> .routeId(String.format("%s.%s", entry.Party,
> entry.Description))
> .to(minaComp.createEndpoint(minaCfg))
> .process(new Processor() {
> @Override
> public void process(Exchange exchange) throws
> Exception {
> StatusUpdate.Instance.send(
> entry.IP,
> String.valueOf(entry.Port),
> InterfaceStatus.Up);
> }
> });
>  
> To summarise the above code, the message is picked up off of a RabbitMQ
> queue, sent to a MINA2 endpoint and then post a status update to a web
> service queue.
>  
> The issue is that the code above will send one HL7 message on a clean
> connection. If I then leave the connection for an indeterminate amount of
> time e.g. 30 minutes, then attempt to send a further message I get the
> following error:
>  
> org.apache.camel.ExchangeTimedOutException: The OUT message was not received
> within: 30000 millis.
>  
> If I run Wireshark I can see that the message attempted to be sent but no
> ACK came back. However, when I run a netstat -a on the client I can see one
> connection open and established. When I run a netstat -a on the server I can
> see 2 connections. One is established, the second is a FIN_WAIT_2 state.
>  
> Does anyone know how to fix this? The server has other application
> connecting and doesn't have this issue. All documentation on FIN_WAIT_2
> indicates a buggy client but I can't see what's wrong. Any help would be
> greatly appreciated.
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Exchange-timeout-Mina2-issues-tp5763509.html
>   
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  

Reply via email to