0

I am using apache-camel as client for http and https requests.

After requests are processed the connections are going into CLOSE_WAIT.

My camel-context doesn't stop after the execution of requests. If I stop it manually then connections are going into TIME_WAIT.

Now I am wondering if I can make connections to go into TIME_WAIT by some configuration in camel-context or code for http requests.

Edited:

  1. I have tried solutions mentioned for this issue like adding "Connection" header with value "close". But it didn't work.

  2. I have used HttpComponent like below to close connections in finally block

Code:

HttpComponent httpComponent = (HttpComponent) pContext.getComponent(ServerConstants.CAMEL_COMPONENT_HTTP);
httpComponent.getHttpConnectionManager().closeIdleConnections(0);

Second solution is working for http connections but not for https.

Solution:

Finally able to make it work by defining custom HeaderFilterStrategy which does not filter Connection:close header and setting this filter bean id in URL as query param.

sasidhar
  • 43
  • 7

0 Answers0