Hi Raul,

can you please provide your inputs on the below piece of code. 

This method the uses the producer template asyncCallback to call the
commonRoute.and i used the future handle to get the response.

  public void getDataUsingProducerTemplate(Exchange exchange) throws
TimeoutException, InterruptedException, ExecutionException {
        ProducerTemplate template = camelContext.createProducerTemplate();
        Future<Exchange> future = template.asyncCallback("direct:commonRoute",
exchange, new  SynchronizationImpl());
        // Retrieve the reply from the main thread, specifying a timeout
        try {
                        future.get(2, TimeUnit.SECONDS);
                }catch (TimeoutException e) {
                        //exchange.setException(e);
                        future.cancel(true);
Thread.sleep(1000)
                        throw e;                        
                }
}

Without the thread sleep my global exception handler (On Exception) is not
able to catch the exception.

Thanks
Ravi




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Timeout-on-a-route-tp5721576p5721623.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to