【问题标题】:camel cxf uri option property.XXX to set http client timeoutcamel cxf uri 选项 property.XXX 设置 http 客户端超时
【发布时间】:2017-06-28 12:10:33
【问题描述】:

可以通过camel cxf uri选项设置客户端超时吗?

可以设置cxf://someAddress?[options],其中options 可以是properties.XXX。 可以以某种方式设置http客户端接收超时吗?

我尝试了很多(在源代码中或通过谷歌找到),但没有一个有效:

properties.com.sun.xml.ws.request.timeout
properties.com.sun.xml.internal.ws.request.timeout
properties.javax.xml.ws.client.receiveTimeout
properties.org.apache.cxf.jms.client.timeout
properties.org.apache.cxf.transport.http.async.SO_TIMEOUT
properties.conduit.client.ReceiveTimeout
properties.org.apache.cxf.transports.http.configuration.client.ReceiveTimeout
properties.http-conf:client.ReceiveTimeout
properties.HTTPClientPolicy.ReceiveTimeout
properties.org.apache.cxf.http.conduits.client.ReceiveTimeout
properties.org.apache.cxf.http.conduit.client.ReceiveTimeout
properties.org.apache.cxf.transports.http.configuration.HTTPClientPolicy.ReceiveTimeout

我知道可以使用 sprinx xml,但我希望它可以通过 Talend 上下文进行配置。

我也知道可以通过CxfEndpointConfigurer bean配置cxf客户端,但是camel 2.13(无法升级)没有configureClient方法。

谢谢你的回答。

【问题讨论】:

    标签: java web-services apache-camel cxf talend


    【解决方案1】:

    正如this document中提到的,你可以配置HTTP Client来设置超时

    <http-conf:conduit name="{http://apache.org/hello_world_soap_http}SoapPort.http-conduit">
      <http-conf:client Connection="Keep-Alive"
                        MaxRetransmits="1"
                        AllowChunking="false" 
                        ConnectionTimeout="60000"
                        ReceiveTimeout="60000"/>
    </http-conf:conduit>
    

    【讨论】:

    • 是的,但是超时被定义为常量。可以使用 osgi 或 camel 属性占位符,它们可以定义为对外部属性文件的引用,但它们也是常量。我想通过 java 从 Talend 实际上下文中填充超时。我还查看了 PropertySourcesPlaceholderConfigurer bean 和 PropertiesComponent 但我不知道它到底可以使用什么以及是否可以使用它。
    【解决方案2】:

    也许您需要使用 RouteBuilder,在您的路由中使用 java 变量。

    Tyr 做这样的事情:

    from("cxf://someAddress?[options]?timeout=${yourTimeOutVariable}")
    

    【讨论】:

    • 嗨。超时是 cxf 组件的未知参数。路线不会开始。我用 properties.XXX 参数试过这个,但我不知道它有什么名字(甚至可能)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-01
    • 1970-01-01
    相关资源
    最近更新 更多