【问题标题】:Setting timeout for Apache Camel CXF consumer component为 Apache Camel CXF 消费者组件设置超时
【发布时间】:2017-06-29 23:17:10
【问题描述】:

我想为 Apache Camel CXF 消费者组件设置超时。

我的代码如下所示:

<route>
   <from uri="direct:NDS/getUserInformation" />
   <to uri="freemarker:file:/application/DT/adapter/NDSLookupService.ftl" />
   <bean ref="ndsServiceLogger" method="logNDSRequest" />
   <setHeader headerName="SOAPAction">
      <simple>getLookUpServiceDetails</simple>
   </setHeader>
   <bean ref="ndsServiceLogger" method="logNDSServiceStartTime" />
   <toD uri="${headers.nds_url}?wsdlURL=/application/DT/adapter/NDSLookupService.wsdl&amp;serviceName={http://webservices.lookup.sdp.bharti.ibm.com}NDSLookupServiceService&amp;portName={http://webservices.lookup.sdp.bharti.ibm.com}NDSLookupService&amp;dataFormat=MESSAGE" />
   <bean ref="ndsServiceLogger" method="logNDSServiceEndTime" />
   <bean ref="ndsServiceLogger" method="logNDSResponse" />
   <convertBodyTo type="java.lang.String" />
</route>

【问题讨论】:

标签: apache-camel cxf


【解决方案1】:

如何尝试属性http.connection.timeouthttp.receive.timeout?

UPD:它不起作用...我可以告诉你去哪里...

我将 CXF 总线用于端点和异步传输(Asynchronous Client HTTP Transport 的文档。 可以像下面这样设置超时。

<cxf-core:bus bus="bus-common-outbound">
    <cxf-core:properties>
        <spring:entry key="use.async.http.conduit" value="true" />
        <spring:entry key="org.apache.cxf.transport.http.async.usePolicy" value="ALWAYS" />
        <spring:entry key="org.apache.cxf.transport.http.async.SO_TIMEOUT" value="45000" /> 
    </cxf-core:properties>      
</cxf-core:bus>

并且端点具有属性“bus”,其“bus”属性指向该属性,例如:bus=bus-common-outbound

也许您可以使用类似的东西或深入挖掘默认同步传输...

【讨论】:

  • 这给出了错误:有 2 个参数无法在端点上设置。如果参数拼写正确并且它们是端点的属性,请检查 uri。未知参数=[{http.connection.timeout=5000, http.receive.timeout=5000}]
  • 知道了...我更新了答案。也许有更简单的方法......但我必须使用异步传输,无论如何最好使用......
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-01-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多