How to achieve connection pooling for Apache camel cxf?

83 Views Asked by At

first of all, I am very new to the Apache camel, I am using 2.18.0 version for Apache camel. Below are the dependencies I have in my project:

  1. camel-core
  2. camel-mina2
  3. camel-spring
  4. camel-stream
  5. camel-script
  6. camel-cxf
  7. camel-jetty9
  8. cxf-rt-transports-http-jetty

The routes are defined in xml files and I am using ProducerTemplate to asynchronously sends the message

ex: producerTempInstance.asyncSendBody(.....);

Now from logs what I can see is the connection getting established for every request, which I dont need, so I thought of maintaining a connection pool for CXF.

But I am unaware of how to achieve it ?

From this documentation https://cxf.apache.org/docs/asynchronous-client-http-transport.html, it says

By default, CXF uses a transport based on the in-JDK HttpURLConnection object to perform HTTP requests.

does that mean if I just add properties like http.maxConnection or keepAlive for my JVM that will do the trick?

But again I am async operations, so will it work in this case as well ?

Also I do see the properties,

org.apache.cxf.transport.http.async.CONNECTION_TTL, org.apache.cxf.transport.http.async.SO_KEEPALIVE

but where do I add them ? and is there any Java way to achieve the same ?

Please let me know if any further info is needed, even if you could nudge me in right direction that will help, Thanks :)

0

There are 0 best solutions below