Package org.apache.camel.model

Examples of org.apache.camel.model.TryDefinition


    }

    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {
                TryDefinition tryType = from("direct:start").doTry().
                        process(validator).
                        to("mock:valid");
                tryType.doCatch(ValidationException.class).to("mock:invalid");
                tryType.doFinally().to("mock:all");
            }
        };
    }
View Full Code Here


        // Since camel doesn't support onException closures together with doCatch/doFinal
        // code below is commented because it doesn't work as expected
        // definition.onException(Throwable.class).processRef(FATAL_ERROR.name());

        TryDefinition tryDefinition = definition.doTry();
        addThrottling(tryDefinition);
       
        tryDefinition
            .processRef(CONSUMER_INTERCEPT.name())
            .processRef(ADDRESSING.name())
            .processRef(TRANSACTION_HANDLER.name())
            .processRef(SECURITY_PROCESS.name())
            .processRef(GENERIC_POLICY.name())
            .processRef(VALIDATION.name())
            .processRef(TRANSFORMATION.name())
            .processRef(VALIDATION.name())
            .processRef(PROVIDER_INTERCEPT.name())
            .processRef(PROVIDER_CALLBACK.name())
            .processRef(PROVIDER_INTERCEPT.name())
            .processRef(SECURITY_CLEANUP.name())
            .processRef(TRANSACTION_HANDLER.name())
            .addOutput(createFilterDefinition());
       
        tryDefinition
            .doCatch(Exception.class)
            .processRef(ERROR_HANDLING.name())
            .processRef(PROVIDER_INTERCEPT.name())
            .processRef(SECURITY_CLEANUP.name())
            .processRef(TRANSACTION_HANDLER.name())
            .addOutput(createFilterDefinition());
       
        tryDefinition.doFinally()
            .processRef(CONSUMER_INTERCEPT.name())
            .processRef(CONSUMER_CALLBACK.name());
    }
View Full Code Here

    }

    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {
                TryDefinition tryType = from("direct:start").doTry().
                        process(validator).
                        to("mock:valid");
                tryType.doCatch(ValidationException.class).to("mock:invalid");
                tryType.doFinally().to("mock:all");
            }
        };
    }
View Full Code Here

        return new RouteBuilder() {
            public void configure() {
                // use little delay to run unit test fast
                errorHandler(deadLetterChannel().delay(25));

                TryDefinition tryType = from("direct:start").tryBlock().
                        process(validator).
                        to("mock:valid");
                tryType.finallyBlock().to("mock:all");
            }
        };
    }
View Full Code Here

    }

    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {
                TryDefinition tryType = from("direct:start").tryBlock().
                        process(validator).
                        to("mock:valid");
                tryType.handle(ValidationException.class).to("mock:invalid");
                tryType.finallyBlock().to("mock:all");
            }
        };
    }
View Full Code Here

    }

    @SuppressWarnings("rawtypes")
    @Override
    public ProcessorDefinition createCamelDefinition() {
        TryDefinition answer = new TryDefinition();

        answer.setInheritErrorHandler(toXmlPropertyValue(PROPERTY_INHERITERRORHANDLER, Objects.<Boolean>getField(this, "inheritErrorHandler")));

        super.savePropertiesToCamelDefinition(answer);
        return answer;
    }
View Full Code Here

    @Override
    protected void loadPropertiesFromCamelDefinition(ProcessorDefinition processor) {
        super.loadPropertiesFromCamelDefinition(processor);

        if (processor instanceof TryDefinition) {
            TryDefinition node = (TryDefinition) processor;

            this.setInheritErrorHandler(Objects.<Boolean>getField(node, "inheritErrorHandler"));
        } else {
            throw new IllegalArgumentException("ProcessorDefinition not an instanceof TryDefinition. Was " + processor.getClass().getName());
        }
View Full Code Here

TOP

Related Classes of org.apache.camel.model.TryDefinition

Copyright © 2018 www.massapicom. 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.