Examples of ErrorHandlerFactory


Examples of org.apache.camel.ErrorHandlerFactory

     * @param output the output
     * @return the output wrapped with the error handler
     * @throws Exception can be thrown if failed to create error handler builder
     */
    protected Processor wrapInErrorHandler(RouteContext routeContext, Processor output) throws Exception {
        ErrorHandlerFactory builder = routeContext.getRoute().getErrorHandlerBuilder();
        // create error handler
        Processor errorHandler = builder.createErrorHandler(routeContext, output);

        // invoke lifecycles so we can manage this error handler builder
        for (LifecycleStrategy strategy : routeContext.getCamelContext().getLifecycleStrategies()) {
            strategy.onErrorHandlerAdd(routeContext, errorHandler, builder);
        }
View Full Code Here

Examples of org.apache.camel.ErrorHandlerFactory

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

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

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

Examples of org.apache.camel.ErrorHandlerFactory

    }

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

        @SuppressWarnings("deprecation")
        ErrorHandlerFactory handler = camelContext.getErrorHandlerBuilder();
        if (handler != null) {
            setErrorHandlerBuilderIfNull(handler);
        }
View Full Code Here

Examples of org.apache.camel.ErrorHandlerFactory

            return false;
        }
        // if error handler ref is configured it may refer to a context scoped, so we need to check this first
        // the XML DSL will configure error handlers using refs, so we need this additional test
        if (errorHandlerRef != null) {
            ErrorHandlerFactory routeScoped = getErrorHandlerBuilder();
            ErrorHandlerFactory contextScoped = context.getErrorHandlerBuilder();
            return routeScoped != null && contextScoped != null && routeScoped == contextScoped;
        }

        return contextScopedErrorHandler;
    }
View Full Code Here

Examples of org.apache.camel.ErrorHandlerFactory

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

Examples of org.apache.camel.ErrorHandlerFactory

     * @param routeContext the route context
     * @param ref          reference id for the error handler
     * @return the error handler
     */
    public static ErrorHandlerFactory lookupErrorHandlerBuilder(RouteContext routeContext, String ref) {
        ErrorHandlerFactory answer;

        // if the ref is the default then we do not have any explicit error handler configured
        // if that is the case then use error handlers configured on the route, as for instance
        // the transacted error handler could have been configured on the route so we should use that one
        if (!isErrorHandlerBuilderConfigured(ref)) {
View Full Code Here

Examples of org.apache.camel.ErrorHandlerFactory

        return answer;
    }

    protected static ErrorHandlerFactory lookupErrorHandlerBuilder(ModelCamelContext camelContext) {
        @SuppressWarnings("deprecation")
        ErrorHandlerFactory answer = camelContext.getErrorHandlerBuilder();
        if (answer instanceof ErrorHandlerBuilderRef) {
            ErrorHandlerBuilderRef other = (ErrorHandlerBuilderRef) answer;
            String otherRef = other.getRef();
            if (isErrorHandlerBuilderConfigured(otherRef)) {
View Full Code Here

Examples of org.apache.camel.ErrorHandlerFactory

     * @param routeContext the route context
     * @param ref          reference id for the error handler
     * @return the error handler
     */
    public static ErrorHandlerFactory lookupErrorHandlerBuilder(RouteContext routeContext, String ref) {
        ErrorHandlerFactory answer;

        // if the ref is the default then we do not have any explicit error handler configured
        // if that is the case then use error handlers configured on the route, as for instance
        // the transacted error handler could have been configured on the route so we should use that one
        if (!isErrorHandlerBuilderConfigured(ref)) {
View Full Code Here

Examples of org.apache.camel.ErrorHandlerFactory

        return answer;
    }

    protected static ErrorHandlerFactory lookupErrorHandlerBuilder(ModelCamelContext camelContext) {
        @SuppressWarnings("deprecation")
        ErrorHandlerFactory answer = camelContext.getErrorHandlerBuilder();
        if (answer instanceof ErrorHandlerBuilderRef) {
            ErrorHandlerBuilderRef other = (ErrorHandlerBuilderRef) answer;
            String otherRef = other.getRef();
            if (isErrorHandlerBuilderConfigured(otherRef)) {
View Full Code Here

Examples of org.apache.camel.ErrorHandlerFactory

     * @param output the output
     * @return the output wrapped with the error handler
     * @throws Exception can be thrown if failed to create error handler builder
     */
    protected Processor wrapInErrorHandler(RouteContext routeContext, Processor output) throws Exception {
        ErrorHandlerFactory builder = routeContext.getRoute().getErrorHandlerBuilder();
        // create error handler
        Processor errorHandler = builder.createErrorHandler(routeContext, output);

        // invoke lifecycles so we can manage this error handler builder
        for (LifecycleStrategy strategy : routeContext.getCamelContext().getLifecycleStrategies()) {
            strategy.onErrorHandlerAdd(routeContext, errorHandler, builder);
        }
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.