HttpConnectionManagerParams not working for HTTPS URL

529 Views Asked by At

We use Apache Camel's camel-http component to integrate with HTTP endpoints, HttpConnectionManagerParams is used to configure defaultconnectionsPerHost and maxTotalConnections.

<bean class="org.apache.commons.httpclient.params.HttpConnectionManagerParams" id="MyHttpConnectionManagerParams">
    <property name="defaultMaxConnectionsPerHost" value="20"/>
    <property name="maxTotalConnections" value="200"/>
</bean>

Above parameters takes effect only if the endpoint URL is over HTTP, same configuration becomes void and default HttpConnectionManager takes effect when endpoint is over HTTPS.

Is there something to be additionally configured for HTTPS url?

1

There are 1 best solutions below

0
On BEST ANSWER

Adding below beans has solved works for me. Agreed there is no component named HTTPS in Camel but things are working with below configuration both in older and newer versions of Apache Camel.

<bean class="org.apache.camel.component.http.HttpComponent" id="http">
   <property name="camelContext" ref="myCamelContext"/>
   <property name="httpConnectionManager" ref="MyHttpConnectionManager"/>
 </bean>
<bean class="org.apache.camel.component.http.HttpComponent" id="https">
   <property name="camelContext" ref="myCamelContext"/>
   <property name="httpConnectionManager" ref="MyHttpConnectionManager"/>
 </bean>
<bean class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager" id="MyHttpConnectionManager">
   <property name="params" ref="MyHttpConnectionManagerParams"/>
 </bean>
<bean class="org.apache.commons.httpclient.params.HttpConnectionManagerParams" id="MyHttpConnectionManagerParams">
   <property name="defaultMaxConnectionsPerHost" value="100"/>
   <property name="maxTotalConnections" value="500"/>
 </bean>