Setting http connection pool timeout in Fuse

Solution Verified - Updated -

Issue

  • We are currently using Fuse as a proxy with cxf for the inbound endpoints, and camel-http for outbound, We are trying to guarantee a maximum time of the http call, and so far have set the following,
<bean id="http" class="org.apache.camel.component.http.HttpComponent">
        <property name="camelContext" ref="FailoverContext" ></property>
        <property name="httpConnectionManager" ref="myHttpConnectionManager" ></property>
    </bean>

    <bean id="https" class="org.apache.camel.component.http.HttpComponent">
        <property name="camelContext" ref="FailoverContext" ></property>
        <property name="httpConnectionManager" ref="myHttpConnectionManager" ></property>
    </bean>

    <bean id="myHttpConnectionManager" class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager">
        <property name="params" ref="myHttpConnectionManagerParams" ></property>
    </bean>

    <bean id="myHttpConnectionManagerParams" class="org.apache.commons.httpclient.params.HttpConnectionManagerParams">
        <property name="defaultMaxConnectionsPerHost" value="100" ></property>
        <property name="maxTotalConnections" value="100" ></property>  
        <property name="connectionTimeout" value="10000" ></property>  <!-- 1 -->
        <property name="soTimeout" value="10000"></property> <!-- 2 -->
    </bean>
  • However, we have found that when the max connections are reached, the httpconnectionmanager will wait indefinitely for a free connection. (timeout=0)
2014-06-09 13:50:36.711 | DEBUG | qtp677732217-131737 - /someUrl/getReferenceData | uuid:a6ba9dc0-efd4-11e3-85fa-c46b98301709 | ltiThreadedHttpConnectionManager | 807 - org.apache.servicemix.bundles.commons-httpclient - 3.1.0.7 | HttpConnectionManager.getConnection:  config = HostConfiguration[host=https://someHost:port.com], timeout = 0
2014-06-09 13:50:36.711 | DEBUG | qtp677732217-131737 - /someUrl/getReferenceData | uuid:a6ba9dc0-efd4-11e3-85fa-c46b98301709 | ltiThreadedHttpConnectionManager | 807 - org.apache.servicemix.bundles.commons-httpclient - 3.1.0.7 | Unable to get a connection, waiting..., hostConfig=HostConfiguration[host=https://someHost:port.com]
  • In the equivalent code below, we can see that the pool timeout can be set... (//3), can this be done in Fuse ?
MultiThreadedHttpConnectionManager connManag =  new MultiThreadedHttpConnectionManager();
HttpConnectionManagerParams managParams = connManag.getParams();

managParams.setConnectionTimeout(connectiontimeout); // 1
managParams.setSoTimeout(sotimeout); //2

HttpMethodBase baseMethod = null;

try {
  HttpClient client = new HttpClient(connManag);
  client.getParams().setParameter("http.connection-manager.timeout", poolTimeout); //3

Environment

  • Red Hat JBoss Fuse
    • 6.x
  • camel-http component

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content