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