Spring Integration HTTPOutboundGateway :: Connection pool和connectionTimeout,soTimeout,maxTotalConnections

时间:2017-09-14 19:21:50

标签: spring-integration

我们正在将基于mule的应用程序转换为spring,在现有代码中我们使用mule HttpsConnector来使用第三方服务,我们希望使用Spring Http Outbound Gateway做同样的事情。 org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler

在这里,我的问题是, 如何启用HTTP连接池? 如何设置像connectionTimeout,soTimeout,maxTotalConnections

这样的道具

这是我想要做的,但是在这里我们不能在requestFactory中注入org.apache.commons.httpclient.HttpClient

      

1 个答案:

答案 0 :(得分:0)

Spring Integration HttpRequestExecutingMessageHandler提供setRequestFactory()注入选项。然后,您可以选择任何方便的ClientHttpRequestFactory实施,例如HttpComponentsClientHttpRequestFactory

 * {@link org.springframework.http.client.ClientHttpRequestFactory} implementation that
 * uses <a href="http://hc.apache.org/httpcomponents-client-ga/">Apache HttpComponents
 * HttpClient</a> to create requests.
 *
 * <p>Allows to use a pre-configured {@link HttpClient} instance -
 * potentially with authentication, HTTP connection pooling, etc.
 *
 * <p><b>NOTE:</b> Requires Apache HttpComponents 4.3 or higher, as of Spring 4.0.