Hello, I asked the question on Stackoverflow (http://stackoverflow.com/questions/38701588/unable-to-configure-keep-alive-in-camel-http-component) but it might be a good idea to ask here too:
I'm having some troubles with the right setup of the HTTP component. Currently a microservice pulls JSON Content from a provider, process it and send it to the next service for further processes. The main problem is that this microservice create a ton of CLOSE_WAIT socket connections. I understand that the whole concept of "KEEP-ALIVE" shall keep the connection open until I close it, but it's possible that the server will drop the connection for some reasons and creates this CLOSE_WAIT socket. I've created a small service for debugging / testing purposes which make a GET Call to Google, but even this connection stays open until i close the program. I've tried many different solutions: *) .setHeader("Connection", constant("Close")) *) -Dhttp.keepAlive=false as VM argument *) Switching from Camel-Http to Camel-Http4 *) httpClient.soTimeout=500 (Camel-HTTP), httpClient.socketTimeout=500 and connectionTimeToLive=500 (Camel-HTTP4) *) .setHeader("Connection", simple("Keep-Alive")) and .setHeader("Keep-Alive", simple("timeout=10")) (Camel-HTTP4) *) Setting via debugging the response of DefaultConnectionKeepAliveStrategy from -1 (never ending) to a specific value in Camel-HTTP4 - that works but I was not able to inject my own strategy. but i had no success. So maybe one of you can help me: *) How can i tell the Camel-HTTP that it should close a connection when a specific time is passed? For example, the service pulls every hour from the content provider. After 3-4 hours the HttpComponent should close the connection after the pull and reopen it when the next pull is there. Currently every connection would be put back into the MultiThreadedHttpConnectionManager and the socket is still open. *) If it's not possible to do that with Camel-HTTP: How can i inject a HttpClientBuilder into the Creation of my route? I know that it should be possible via httpClient option but I don't understand that specific part of the documentation. Thank you all for your help - this problem is slightly annoying because sometimes critical services can't process the data correctly because of tons of CLOSE_WAIT connections... -- View this message in context: http://camel.465427.n5.nabble.com/Unable-to-configure-Keep-Alive-in-Camel-HTTP-component-tp5785803.html Sent from the Camel - Users mailing list archive at Nabble.com.