我用骆驼做编曲引擎。
clients sends HTTP request <-> CAMEL code <---- HTTP Req----- > external
server(s)
我使用HTTP4组件(具有默认设置)向外部服务器发出HTTP请求。我有很多http后端。
目前,我们对后端进行http调用的方式如下:
// 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);
}
});
我要问的是:-
HTTP4
是否在调用外部服务器时使用某些http连接池?blueprint.xml
配置连接池?我使用的是Camel 2.16.1
,应用程序部署在Karaf 3.0.5
中。
发布于 2016-03-12 10:47:16
http4
组件使用Apache HttpClient,通过使用HttpClientConnectionManager
支持池。
默认情况下,camel使用用属性PoolingHttpClientConnectionManager
和maxTotalConnections
配置的connectionsPerRoute
。
如果您希望对此clientConnectionManager有更多的控制权,可以提供您自己的org.apache.http.conn.HttpClientConnectionManager
实现。
https://stackoverflow.com/questions/35960470
复制相似问题