@Override public void configure() throws Exception { from("direct:input") // Enable the following statement if error handling // has been globally turned off via noErrorHandler(), // otherwise exception() statements have no effect. //.errorHandler(deadLetterChannel()) .onException(Exception1.class).to("mock:error1").end() .onException(Exception2.class).to("mock:error2").end() .onException(Exception.class).to("mock:error3").end() .process(exceptionProcessor()) .to("mock:success"); }
@Override public void configure() throws Exception { getContext().setTracing(true); // general error handler errorHandler(defaultErrorHandler() .maximumRedeliveries(5) .redeliveryDelay(2000) .retryAttemptedLogLevel(LoggingLevel.WARN)); // in case of a http exception then retry at most 3 times // and if exhausted then upload using ftp instead onException(HttpOperationFailedException.class).maximumRedeliveries(3) .handled(true) // use file instead of ftp as its easier to play with .to("file:target/ftp/upload"); // poll files every 5th second and send them to the HTTP server from("file:target/rider?delay=5000&readLock=none") .to("http://localhost:8765/rider"); } }
@Override public void configure() throws Exception { getContext().setTracing(true); // general error handler errorHandler(defaultErrorHandler() .maximumRedeliveries(5) .redeliveryDelay(2000) .retryAttemptedLogLevel(LoggingLevel.WARN)); // in case of a http exception then retry at most 3 times // and if exhausted then upload using ftp instead onException(IOException.class, HttpOperationFailedException.class) .maximumRedeliveries(3) .handled(true) .to(ftp); // poll files send them to the HTTP server from(file).to(http); }
@Override public void configure() throws Exception { getContext().setTracing(true); // general error handler errorHandler(defaultErrorHandler() .maximumRedeliveries(5) .redeliveryDelay(2000) .retryAttemptedLogLevel(LoggingLevel.WARN)); // in case of a http exception then retry at most 3 times // and if exhausted then upload using ftp instead onException(IOException.class, HttpOperationFailedException.class) .maximumRedeliveries(3) .handled(true) .to(ftp); // poll files send them to the HTTP server from(file).to(http); }
@Override public void configure() throws Exception { getContext().setTracing(true); // general error handler errorHandler(defaultErrorHandler() .maximumRedeliveries(5) .redeliveryDelay(2000) .retryAttemptedLogLevel(LoggingLevel.WARN)); // in case of a http exception then retry at most 3 times // and if exhausted then upload using ftp instead onException(HttpOperationFailedException.class).maximumRedeliveries(3) .handled(true) // use file instead of ftp as its easier to play with .to("file:target/ftp/upload"); // poll files every 5th second and send them to the HTTP server from("file:target/rider?delay=5000&readLock=none") .to("http://localhost:8765/rider"); } }
@Override public void configure() throws Exception { onException(ValidationException.class).to("mock:error"); from("direct:validator-test").process( helper.validator("testValidator").staticProfile("correct")); from("direct:validator-xml-test").process( helper.xsdValidator().staticProfile("/xsd/test.xsd")).setBody() .constant("passed"); from("direct:validator-schematron-test").process( helper.schematronValidator().staticProfile( new SchematronProfile( "/schematron/schematron-test-rules.xml"))) .setBody().constant("passed"); }
.routeId("onException") .handled(true) .to("direct:sendFailureResponse");
.to(URI_ERROR_HANDLING);