Search in sources :

Example 1 with ErrorHandlerBuilderRef

use of org.apache.camel.builder.ErrorHandlerBuilderRef in project camel by apache.

the class ContextScopedOnExceptionRouteScopedErrorHandlerRefIssueTwoRoutesTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            onException(IllegalArgumentException.class).handled(true).to("mock:handled").end();
            from("direct:foo").errorHandler(new ErrorHandlerBuilderRef("myDLC")).to("mock:foo").throwException(new IOException("Damn IO"));
            from("direct:start").errorHandler(new ErrorHandlerBuilderRef("myDLC")).to("mock:a").throwException(new IllegalArgumentException("Damn"));
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) IOException(java.io.IOException) ErrorHandlerBuilderRef(org.apache.camel.builder.ErrorHandlerBuilderRef)

Example 2 with ErrorHandlerBuilderRef

use of org.apache.camel.builder.ErrorHandlerBuilderRef in project camel by apache.

the class ContextScopedOnExceptionNotHandledErrorHandlerRefIssueTwoRoutesTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            errorHandler(new ErrorHandlerBuilderRef("myDLC"));
            onException(IllegalArgumentException.class).handled(false).to("mock:handled").end();
            from("direct:foo").to("mock:foo").throwException(new IOException("Damn IO"));
            from("direct:start").to("mock:a").throwException(new IllegalArgumentException("Damn"));
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) IOException(java.io.IOException) ErrorHandlerBuilderRef(org.apache.camel.builder.ErrorHandlerBuilderRef)

Example 3 with ErrorHandlerBuilderRef

use of org.apache.camel.builder.ErrorHandlerBuilderRef in project camel by apache.

the class ContextScopedOnExceptionNotHandledRouteScopedErrorHandlerRefIssueTwoRoutesTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            onException(IllegalArgumentException.class).handled(false).to("mock:handled").end();
            from("direct:foo").errorHandler(new ErrorHandlerBuilderRef("myDLC")).to("mock:foo").throwException(new IOException("Damn IO"));
            from("direct:start").errorHandler(new ErrorHandlerBuilderRef("myDLC")).to("mock:a").throwException(new IllegalArgumentException("Damn"));
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) IOException(java.io.IOException) ErrorHandlerBuilderRef(org.apache.camel.builder.ErrorHandlerBuilderRef)

Example 4 with ErrorHandlerBuilderRef

use of org.apache.camel.builder.ErrorHandlerBuilderRef in project camel by apache.

the class OnExceptionErrorHandlerRefIssueTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            errorHandler(new ErrorHandlerBuilderRef("myDLC"));
            from("direct:start").onException(IllegalArgumentException.class).handled(true).to("mock:handled").end().to("mock:a").throwException(new IllegalArgumentException("Damn"));
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) ErrorHandlerBuilderRef(org.apache.camel.builder.ErrorHandlerBuilderRef)

Example 5 with ErrorHandlerBuilderRef

use of org.apache.camel.builder.ErrorHandlerBuilderRef in project camel by apache.

the class OnExceptionRouteScopedErrorHandlerRefIssueTwoRoutesTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            from("direct:foo").errorHandler(new ErrorHandlerBuilderRef("myDLC")).to("mock:foo").throwException(new IllegalArgumentException("Damn Foo"));
            from("direct:start").errorHandler(new ErrorHandlerBuilderRef("myDLC")).onException(IllegalArgumentException.class).handled(true).to("mock:handled").end().to("mock:a").throwException(new IllegalArgumentException("Damn"));
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) ErrorHandlerBuilderRef(org.apache.camel.builder.ErrorHandlerBuilderRef)

Aggregations

ErrorHandlerBuilderRef (org.apache.camel.builder.ErrorHandlerBuilderRef)17 RouteBuilder (org.apache.camel.builder.RouteBuilder)13 IOException (java.io.IOException)4 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 XmlAttribute (javax.xml.bind.annotation.XmlAttribute)1 ErrorHandlerFactory (org.apache.camel.ErrorHandlerFactory)1 ErrorHandlerBuilder (org.apache.camel.builder.ErrorHandlerBuilder)1