我们正在将基于mule的应用程序转换为spring,在现有代码中我们使用mule HttpsConnector来使用第三方服务,我们希望使用Spring Http Outbound Gateway做同样的事情。 org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler
在这里,我的问题是, 如何启用HTTP连接池? 如何设置像connectionTimeout,soTimeout,maxTotalConnections
这样的道具这是我想要做的,但是在这里我们不能在requestFactory中注入org.apache.commons.httpclient.HttpClient
答案 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.