3
我想設置一個駱駝CXF-RS組件here的'connectionTimeout',它在第三方服務上產生一個RESTful請求。默認的30000
毫秒是很長的。駱駝cxfrs RESTful客戶端/ ProducerTemplate ConnectionTimeout
Exchange exchange = template.send("cxfrs://" + url, new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.setPattern(ExchangePattern.InOut);
Message inMessage = exchange.getIn();
setupDestinationURL(inMessage);
// using the http central client API
inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, Boolean.TRUE);
// set the Http method
inMessage.setHeader(Exchange.HTTP_METHOD, "PUT");
// set the relative path
inMessage.setHeader(Exchange.HTTP_PATH, url);
// Specify the response class , cxfrs will use InputStream as the response object type
inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, Customer.class);
// set a customer header
inMessage.setHeader("key", "value");
// since we use the Get method, so we don't need to set the message body
inMessage.setBody(null);
}
});
我曾嘗試加入這個我們application-context
正如許多人所建議的,但不能看透HTTPConduit
和HTTPClientPolicy
類的調試時,修改默認值:
<http-conf:conduit name="*.http-conduit">
<http-conf:client ConnectionTimeout="5000"/>
</http-conf:conduit>
,我曾嘗試追加
"?httpClientAPI=true&connectionTimeout=5000"
作爲url字符串的選項。
任何幫助或指導將不勝感激。