Reputation: 6852
I am using Camel as an Orchestration Engine.
clients sends HTTP request <-> CAMEL code <---- HTTP Req----- > external
server(s)
I am using HTTP4 Component (with default settings) for making HTTP Requests to external server. I have quite a few http backends.
Right now the way we are making http calls to our backend is as follow:-
// The producer is created during app initialisation. This is actually done
via blueprint.xml
ProducerTemplate producer = camelContext.createProducerTemplate();
// Whenever I need to make a http call I am executing the below code with
URL set as something like:- "http4://order-api:8099/orders/v1/ordersearch/"
Exchange exchange = producer.request(URL, new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
log.info("Executing the HTTP request : URL - " + URL + " Headers -
" + headers + " Body : " + body);
exchange.getIn().setHeaders(headers);
exchange.getIn().setBody(body);
}
});
The query I am having is:-
HTTP4
in the default setting camel uses some http connection
pooling while making a call to the external servers?blueprint.xml
? I am using Camel 2.16.1
and the application is deployed in Karaf 3.0.5
.
Upvotes: 4
Views: 7460
Reputation: 11022
The http4
component use Apache HttpClient, which support pooling with the use of a HttpClientConnectionManager
.
By default, camel uses a PoolingHttpClientConnectionManager
which is configured with the properties connectionsPerRoute
and maxTotalConnections
.
If you want to have more control over this clientConnectionManager, you can provide your own implementation of org.apache.http.conn.HttpClientConnectionManager
See HttpClient connection manager
Upvotes: 10