I guess you could create you own clientConnectionManager (see the option on
the HTTP/HTTP4 component documentation) that returns a decorated HTTP
client that, when execute is called, creates the timer and starts it.
Or do some other more fancy handling to avoid having to start another
thread for each request.

Best regards
Pontus

On Wed, 1 Jul 2015 13:07 Henrik Brautaset Aronsen <[email protected]> wrote:

> I can control the httpclient connection and socket timeouts by adding query
> parameters to the URL delivered in ProcessorDefinition.to(), e.g. "
>
> http://example.com/stuff?httpClient.connectTimeout=1000&httpClient.socketTimeout=5000
> "
>
> I'd like to have an hard overall time limit on the request, though.
> HttpClient doesn't support that as an argument, but it has an abort() call
> that can be used like this:
>
>     DefaultHttpClient httpClient = new DefaultHttpClient();
>     HttpGet getMethod = new HttpGet("http://example.com/stuff";);
>     TimerTask task = new TimerTask() {
>         @Override
>         public void run() {
>             if (getMethod != null) {
>                 getMethod.abort();
>             }
>         }
>     };
>     new Timer(true).schedule(task, 5000);
>     HttpResponse response = httpClient.execute(getMethod);
>
> How can I achieve the same in a Camel route?
>
> Cheers,
> Henrik
>

Reply via email to