Examples of ErrorHandlerBuilder


Examples of org.apache.camel.builder.ErrorHandlerBuilder

    // Implementation methods
    //-------------------------------------------------------------------------
    protected RouteDefinition createRoute() {
        RouteDefinition route = new RouteDefinition();
        ErrorHandlerBuilder handler = getErrorHandlerBuilder();
        if (handler != null) {
            route.setErrorHandlerBuilderIfNull(handler);
        }
        return route;
    }
View Full Code Here

Examples of org.apache.camel.builder.ErrorHandlerBuilder

            // wrap the producer in error handler so we have fine grained error handling on
            // the output side instead of the input side
            // this is needed to support redelivery on that output alone and not doing redelivery
            // for the entire multicast block again which will start from scratch again
            RouteContext routeContext = exchange.getUnitOfWork().getRouteContext();
            ErrorHandlerBuilder builder = routeContext.getRoute().getErrorHandlerBuilder();
            // create error handler (create error handler directly to keep it light weight,
            // instead of using ProcessorDefinition.wrapInErrorHandler)
            try {
                prepared = builder.createErrorHandler(routeContext, prepared);
            } catch (Exception e) {
                throw ObjectHelper.wrapRuntimeCamelException(e);
            }
        }
View Full Code Here

Examples of org.apache.camel.builder.ErrorHandlerBuilder

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // will use original
                ErrorHandlerBuilder a = deadLetterChannel("mock:a")
                    .maximumRedeliveries(2).redeliveryDelay(0).logStackTrace(false).useOriginalMessage().handled(true);

                // will NOT use original
                ErrorHandlerBuilder b = deadLetterChannel("mock:b")
                    .maximumRedeliveries(2).redeliveryDelay(0).logStackTrace(false).handled(true);

                from("activemq:queue:a")
                    .errorHandler(a)
                    .setBody(body().append(" World"))
View Full Code Here

Examples of org.apache.camel.builder.ErrorHandlerBuilder

    }

    public List<RouteContext> addRoutes(CamelContext camelContext, Collection<Route> routes) throws Exception {
        List<RouteContext> answer = new ArrayList<RouteContext>();

        ErrorHandlerBuilder handler = camelContext.getErrorHandlerBuilder();
        if (handler != null) {
            setErrorHandlerBuilderIfNull(handler);
        }

        for (FromDefinition fromType : inputs) {
View Full Code Here

Examples of org.apache.camel.builder.ErrorHandlerBuilder

        } else {
            // do not wrap as there is no child output
            errorHandler = null;
        }
        // lookup the error handler builder
        ErrorHandlerBuilder builder = routeContext.getRoute().getErrorHandlerBuilder();
        // and add this as error handlers
        builder.addErrorHandlers(this);
    }
View Full Code Here

Examples of org.apache.camel.builder.ErrorHandlerBuilder

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // will use original
                ErrorHandlerBuilder a = deadLetterChannel("mock:a")
                    .maximumRedeliveries(2).redeliveryDelay(0).logStackTrace(false).useOriginalMessage().handled(true);

                // will NOT use original
                ErrorHandlerBuilder b = deadLetterChannel("mock:b")
                    .maximumRedeliveries(2).redeliveryDelay(0).logStackTrace(false).handled(true);

                from("direct:a")
                    .errorHandler(a)
                    .setBody(body().append(" World"))
View Full Code Here

Examples of org.apache.camel.builder.ErrorHandlerBuilder

                LOG.trace("Using existing error handler for: {}", processor);
                return answer;
            }

            LOG.trace("Creating error handler for: {}", processor);
            ErrorHandlerBuilder builder = routeContext.getRoute().getErrorHandlerBuilder();
            // create error handler (create error handler directly to keep it light weight,
            // instead of using ProcessorDefinition.wrapInErrorHandler)
            try {
                processor = builder.createErrorHandler(routeContext, processor);
                // must start the error handler
                ServiceHelper.startServices(processor);
            } catch (Exception e) {
                throw ObjectHelper.wrapRuntimeCamelException(e);
            }
View Full Code Here

Examples of org.apache.camel.builder.ErrorHandlerBuilder

        }
        if (handleFault != null) {
            ctx.setHandleFault(handleFault);
        }
        if (errorHandlerRef != null) {
            ErrorHandlerBuilder errorHandlerBuilder = (ErrorHandlerBuilder) getApplicationContext().getBean(errorHandlerRef, ErrorHandlerBuilder.class);
            if (errorHandlerBuilder == null) {
                throw new IllegalArgumentException("Cannot find ErrorHandlerBuilder bean with id: " + errorHandlerRef);
            }
            ctx.setErrorHandlerBuilder(errorHandlerBuilder);
        }
View Full Code Here

Examples of org.apache.camel.builder.ErrorHandlerBuilder

            setOnRedelivery(routeContext.lookup(onRedeliveryRef, Processor.class));
        }

        // lets attach this on exception to the route error handler
        errorHandler = routeContext.createProcessor(this);
        ErrorHandlerBuilder builder = routeContext.getRoute().getErrorHandlerBuilder();
        builder.addErrorHandlers(this);
    }
View Full Code Here

Examples of org.apache.camel.builder.ErrorHandlerBuilder

   
    public List<RouteContext> addRoutes(CamelContext context, Collection<Route> routes) throws Exception {
        List<RouteContext> answer = new ArrayList<RouteContext>();
        setCamelContext(context);

        ErrorHandlerBuilder handler = context.getErrorHandlerBuilder();
        if (handler != null) {
            setErrorHandlerBuilderIfNull(handler);
        }

        for (FromDefinition fromType : inputs) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.