Hi,

I followed this exemple on camel site.
"http://camel.apache.org/exception-clause.html";. 

I want to catch all Exception and stop the program when the first Exception
is catched.

Here the main  program : 

******************************************************
 public void configure(){

        onException(Exception.class).process(new
MyFunctionFailureHandler()).stop();
   
        from("file:///D:/fileCamel/in?noop=true")
        .bean(BeanTest.class, "myfonction")
        .to("file:///D:/fileCamel/in");
    }
******************************************************


Here the BeanTest:
******************************************************
public class BeanTest {
        
        
        public void myfonction(Exchange exchange) throws Exception{
                System.out.println("IN myfonction");
                throw new Exception();
        }
}
******************************************************

Here the class MyFunctionFailureHandler .

******************************************************
public class MyFunctionFailureHandler  implements Processor {

        @Override
        public void process(Exchange exchange) throws Exception {
         
        Throwable caused;
                caused = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, 
Throwable.class);
                System.out.println("ERREUR EXCEPTION " + caused);
        // send it to our mock endpoint
        exchange.getContext().createProducerTemplate().send("mock:myerror",
exchange);
        }
        
}
******************************************************

but it doesn't work .
Where should i put the "OnException(...) on the main program to catch
Exception and stop the program.









--
View this message in context: 
http://camel.465427.n5.nabble.com/OnException-Problem-tp5725110.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to