我正在使用带有http4组件的scala akka-camel(2.12.2版本) . 我正在创建一个带 endpoints 的Camel 生产环境 者:
def endpointUri = "https4://host-path" +
"?bridgeEndpoint=true" +
"&httpClientConfigurer=#configurer" +
"&clientConnectionManager=#manager"
其中 configurer
是在Camel上下文注册表中注册的 HttpClientConfigurer
(同样的原则适用于 manager
) .
当我将CamelMessage发送到该 endpoints 时,我可以在akka上看到日志:
DEBUG o.a.c.component.http4.HttpComponent - Creating endpoint uri https4://host-path?bridgeEndpoint=true&httpClientConfigurer=#configurer&clientConnectionManager=#manager
DEBUG o.a.camel.util.IntrospectionSupport - Configured property: clientConnectionManager on bean: Endpoint["https4://host-path?bridgeEndpoint=true&httpClientConfigurer=#configurer&clientConnectionManager=#manager"] with value: org.apache.http.impl.conn.PoolingClientConnectionManager@3da3d36f
DEBUG o.a.camel.util.IntrospectionSupport - Configured property: bridgeEndpoint on bean: Endpoint["https4://host-path?bridgeEndpoint=true&httpClientConfigurer=#configurer&clientConnectionManager=#manager"] with value: true
INFO o.a.c.component.http4.HttpComponent - Registering SSL scheme https on port 443
INFO o.a.c.component.http4.HttpComponent - Registering SSL scheme https4 on port 443
所以httpClientConfigurer没有配置,我不知道它为什么忽略这个参数 . 我一直在寻找Apache Camel问题跟踪器的任何相关问题,但我发现没有类似的东西 .
任何的想法?提前致谢 .
2 回答
最后,'s resolved. I haven' t使用了
clientConnectionManager
或httpClientConfigurer
中的任何一个 . 我使用了SSLContextParams
和一个名为TlsConfigurer的特性,它意味着与Producer混合使用 .我想使用不同的X509证书,因此,正如Camel建议的那样:
因此,TlsConfigurer
configure
方法必须能够从camel上下文获取http4
组件实例,然后应用SSLContextParams并将修改后的实例作为新组件添加到camel上下文 .这是它的样子:
这样我就可以创建两个不同的 endpoints :
http-client1://...
和http-client2://...
并以单独的方式管理它们的证书 .使用IntrospectionSupport未将httpClientConfigurer设置为HttpEndpoint,因此您看不到调试日志 . 我想我们要知道在客户配置器中添加一些日志时会调用configurer .