How to do connection pooling on CXF endpoint
niteshjain132 Sep 9, 2016 2:06 AMI'm using camel 2.15.3 and cxf 3.0.6
I have an cxf endpoint as below in my camel context .. (TEST_ENDPOINT is an actual endpoint)
<to uri="cxf://{{TEST_ENDPOINT}}?dataFormat=payload&loggingFeatureEnabled=true" />
I wanted to limit the number of HTTP connections to TEST_ENDPOINT, Tried below but it doesn't help..
<bean id="http" class="org.apache.camel.component.http.HttpComponent">
<property name="camelContext" ref="sendSMSContext_rest" />
<property name="httpConnectionManager" ref="myHttpConnectionManager" />
</bean>
<bean id="myHttpConnectionManager"
class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager">
<property name="params" ref="myHttpConnectionManagerParams" />
</bean>
<bean id="myHttpConnectionManagerParams"
class="org.apache.commons.httpclient.params.HttpConnectionManagerParams">
<property name="maxTotalConnections" value="5" />
</bean>
according to this post http://cxf.547215.n5.nabble.com/HTTP-Connection-Pooling-td561783.html,
CXF relies on the out-of-the-box java.net URL and HttpURLConnection, so i also tried setting up the following in my camel context xml
<bean id="systemProps"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" value="#{@systemProperties}" />
<property name="targetMethod" value="putAll" />
<property name="arguments">
<util:properties>
<prop key="http.maxConnections">10</prop>
<prop key="Connection">close</prop>
</util:properties>
</property>
</bean>
But still i can see more than 200 Established connections, seems like there is no effect ...
When i do a load test, i can see 200+ ESTABLISHED connection, though maxTotalConnections is 5 !!
any help is appreciated.
CXF relies on the out-of-the-box java.net URL and HttpURLConnection