Camel cxfrs RESTful client / ProducerTemplate ConnectionTimeout

前端 未结 1 649
情书的邮戳
情书的邮戳 2021-01-14 12:27

I am trying to set the \'connectionTimeout\' for a Camel CXF-RS component here which produces a RESTful requests on a 3rd party service. The default 30000 milis

相关标签:
1条回答
  • 2021-01-14 13:02

    Adding the http-conf:conduit element in application-context as you did is the way to go and should work. What makes you say it does not?

    Quite often a backend server take too long to answer, after the connection is made; in this case setting ReceiveTimeout is as important as ConnectionTimeout.

    This is a sample camel Route which consumes RS requests and calls a third-party RS server; the ReceiveTimeout and ConnectionTimeout parameters work as expected.

    <cxf:rsServer id="rsFrontServer" address="..." serviceClass="..."/>
    
    <cxf:rsClient id="rsBackendClient" address=".../" serviceClass="..."/>
    
    <http-conf:conduit name="*.http-conduit">
        <http-conf:client ReceiveTimeout="5000" ConnectionTimeout="5000"/>
    </http-conf:conduit>
    
    <camelContext xmlns="http://camel.apache.org/schema/spring">
        <route id="front">
            <from uri="cxfrs:bean:rsFrontServer"/>
            <!-- do stuff -->
            <to uri="cxfrs:bean:rsBackendClient"/>
        </route>
    </camelContext>
    
    0 讨论(0)
提交回复
热议问题