Re: How to configure http client?
ok, thanks for the answer. I ended up doing the following. Seems to be working ok. HttpComponent http4Component = camelContext.getComponent("http4", HttpComponent.class); http4Component.setHttpClientConfigurer(new HttpClientSocketTimeoutConfigurer()); HttpComponent https4Component = camelContext.getComponent("https4", HttpComponent.class); https4Component.setHttpClientConfigurer(new HttpClientSocketTimeoutConfigurer()); public void configureHttpClient(HttpClient client) { HttpParams httpParams = client.getParams(); HttpConnectionParams.setConnectionTimeout(httpParams, TIMEOUT_IN_MILLIS); HttpConnectionParams.setSoTimeout(httpParams, TIMEOUT_IN_MILLIS); } -- View this message in context: http://camel.465427.n5.nabble.com/How-to-configure-http-client-tp5743784p5743950.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to configure http client?
No, HttpComponent.setConnectionTimeToLive() is used to set the connection manager timeToLive option, it has nothing to do with the SO_TIMEOUT. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Wednesday, November 27, 2013 at 5:04 PM, PJ Walstroem wrote: > thank you, Willem, > so the code suggested would actually set the SO_TIMEOUT on the http-client? > I can not seem to get it to work, but will try further to try to figure it > out. > > I also notice the HttpComponent.setConnectionTimeToLive(). Would that > accomplish the same behaviour? > > best regard, Per Jorgen > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/How-to-configure-http-client-tp5743784p5743902.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com).
Re: How to configure http client?
thank you, Willem, so the code suggested would actually set the SO_TIMEOUT on the http-client? I can not seem to get it to work, but will try further to try to figure it out. I also notice the HttpComponent.setConnectionTimeToLive(). Would that accomplish the same behaviour? best regard, Per Jorgen -- View this message in context: http://camel.465427.n5.nabble.com/How-to-configure-http-client-tp5743784p5743902.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to configure http client?
I’m afraid you need to wait for a while after we remove the deprecated API of HttpClient 4.x. In the meantime I think you can still use the MyHttpClientConfigurer to do the job. BTW, I just fill a JIRA[1] for it. [1]https://issues.apache.org/jira/browse/CAMEL-7010 -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Monday, November 25, 2013 at 7:31 PM, PJ Walstroem wrote: > I could use the code below (as suggested in > http://camel.apache.org/http4.html), but seems like any calls on the > HttpClient are deprecated in HttpClient 4.3. Any non-deprecated suggestions? > > HttpComponent httpComponent = getContext().getComponent("http4", > HttpComponent.class); > httpComponent.setHttpClientConfigurer(new MyHttpClientConfigurer()); > > public class MyHttpClientConfigurer implements HttpClientConfigurer { > public void configureHttpClient(HttpClient client) { > client.getParams().setIntParameter("httpClient.soTimeout", 5); > } > } > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/How-to-configure-http-client-tp5743784p5743790.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com).
Re: How to configure http client?
I could use the code below (as suggested in http://camel.apache.org/http4.html), but seems like any calls on the HttpClient are deprecated in HttpClient 4.3. Any non-deprecated suggestions? HttpComponent httpComponent = getContext().getComponent("http4", HttpComponent.class); httpComponent.setHttpClientConfigurer(new MyHttpClientConfigurer()); public class MyHttpClientConfigurer implements HttpClientConfigurer { public void configureHttpClient(HttpClient client) { client.getParams().setIntParameter("httpClient.soTimeout", 5); } } -- View this message in context: http://camel.465427.n5.nabble.com/How-to-configure-http-client-tp5743784p5743790.html Sent from the Camel - Users mailing list archive at Nabble.com.
How to configure http client?
hello, we have the following entry in our route: .to(routeConfig.getSupplierUri()) where supplierUri could be (1) https4:foo.com/MetaSearchService_v1.asmx (2) https4:bar.com/service?username=foo etc. (we configure around 30 of these routes) What we would like to do, is to set a global soTimeout for alle the http4-endpoints. Something like this: .to(routeConfig.getSupplierUri() + "?httpClient.soTimeout=5000") However, this is not so straightforward as we need logic to decide if we should add the query mark or not as this might be added already (as in example 2 above) Is it possible to use http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/params/BasicHttpParams.html or org.apache.http.client.config to accomplish this? any suggestions would be highly appreciated! /pj -- View this message in context: http://camel.465427.n5.nabble.com/How-to-configure-http-client-tp5743784.html Sent from the Camel - Users mailing list archive at Nabble.com.