camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Srivatsa Katta <vatsa.ka...@gmail.com>
Subject Re: Changing retry handler for http component
Date Wed, 26 Aug 2009 07:23:01 GMT

Hi,

Oops.. it was my stupid mistake in the test..

Actually I have a route that bridges between jetty and http components..

eg:
from("jetty:http://firstHost?matchOnUriPrefix=true").to("http://secondHost?throwExceptionOnFailure=false&httpClientConfigurerRef=httpClientConfigurer");

In my test (which uses commons http client api) I gave a wrong host hence it
was failing.. 

it did work.. thanks guys!

And yeah am still using 2.0 M2 because of this bug
(https://issues.apache.org/activemq/browse/CAMEL-1925) in the latest
release.

Cheers!!
Katta




Claus Ibsen-2 wrote:
> 
> On Wed, Aug 26, 2009 at 9:07 AM, Srivatsa Katta<vatsa.katta@gmail.com>
> wrote:
>>
>> Hi,
>>
>> I did try using the httpClientConfigurerRef option on http component, but
>> it
>> doesn't seem to pick up the given implementation.
>>
>> My route looks like this.
>>
>> from("http://myhost:8080?throwExceptionOnFailure=false&httpClientConfigurerRef=httpClientConfigurer"
>>
>> And I have a bean declared in spring context xml like this..
>>
>> <bean id="httpClientConfigurer"
>> class="org.xyz.core.transport.camel.DefaultHttpClientConfigurer" />
>>
>> The DefaultHttpClientConfigurer looks like this..
>>
>>  public void configureHttpClient(HttpClient client) {
>>        DefaultHttpMethodRetryHandler retryhandler = new
>> DefaultHttpMethodRetryHandler(0, false);
>>        client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
>> retryhandler);
>>        client.getParams().setSoTimeout(1000);
>>    }
>>
>> Is there anything else am missing ??
> 
> Try debugging or do some system out in your class to see whether it is
> invoked.
> 
> BTW Which Camel version are you using?
> 
> 
>>
>> Cheers!
>> Katta
>>
>>
>>
>> willem.jiang wrote:
>>>
>>> Yeah, you already find the answer yourself.
>>> Here is the example[1] that you may need :)
>>>
>>> [1]
>>> https://svn.apache.org/repos/asf/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/BasicAuthenticationHttpClientConfigurer.java
>>>
>>> Willem
>>>
>>> Srivatsa Katta wrote:
>>>> Oh I believe httpClientConfigurerRef option can be used.. will give it
>>>> a
>>>> shot..
>>>>
>>>>
>>>>
>>>> Srivatsa Katta wrote:
>>>>> Hi,
>>>>>
>>>>> Am using http component and the route looks something like this.
>>>>>
>>>>> from("direct:client").to("http://myhost:8080/?
>>>>> throwExceptionOnFailure=false");
>>>>>
>>>>> If the server is down/not reachable, the http component does retry for
>>>>> 3
>>>>> times (as observed from the logs) and then throws up the connection
>>>>> time
>>>>> out exception.
>>>>>
>>>>> Yes there is a way to set timeout option on http component, but how do
>>>>> I
>>>>> set a custom http client retry handler. If I had to do this for
>>>>> commons
>>>>> http client programaticaly, it can be done like shown below
>>>>>
>>>>> httpclient.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
>>>>> new
>>>>> DefaultHttpMethodRetryHandler(0, false));
>>>>>
>>>>> How do I do this configuration for http component in camel ??
>>>>>
>>>>> One way I could think of as described in http component documentation,
>>>>> override the httpComponent settings in the spring.xml by setting
>>>>> params,
>>>>> connection manager etc. Was just wondering is there any simpler way ??
>>>>>
>>>>> Any help appreciated.
>>>>>
>>>>> Cheers!!
>>>>> Katta
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Changing-retry-handler-for-http-component-tp25139892p25147696.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://www.nabble.com/Changing-retry-handler-for-http-component-tp25139892p25147869.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message