Java 类org.apache.camel.builder.DefaultErrorHandlerBuilder 实例源码

项目:camel-cdi    文件:XmlErrorHandlerFactoryBean.java   
@Override
public ErrorHandlerBuilder create(CreationalContext<ErrorHandlerBuilder> creationalContext) {
    try {
        ErrorHandlerBuilder builder = handler.getType().getTypeAsClass().newInstance();

        switch (handler.getType()) {
            case DefaultErrorHandler:
            case DeadLetterChannel:
                setProperties((DefaultErrorHandlerBuilder) builder);
                break;
            case LoggingErrorHandler:
                setProperties((LoggingErrorHandlerBuilder) builder);
                break;
            case NoErrorHandler:
                // No configuration required
                break;
            case TransactionErrorHandler:
                break;
        }

        return builder;
    } catch (Exception cause) {
        throw new CreationException("Error while creating instance for " + this, cause);
    }
}
项目:Camel    文件:XmlErrorHandlerFactoryBean.java   
@Override
public ErrorHandlerBuilder create(CreationalContext<ErrorHandlerBuilder> creationalContext) {
    try {
        ErrorHandlerBuilder builder = handler.getType().getTypeAsClass().newInstance();

        switch (handler.getType()) {
        case DefaultErrorHandler:
        case DeadLetterChannel:
            setProperties((DefaultErrorHandlerBuilder) builder);
            break;
        case LoggingErrorHandler:
            setProperties((LoggingErrorHandlerBuilder) builder);
            break;
        case NoErrorHandler:
            // No configuration required
            break;
        case TransactionErrorHandler:
            break;
        default:
            break;
        }

        return builder;
    } catch (Exception cause) {
        throw new CreationException("Error while creating instance for " + this, cause);
    }
}
项目:Camel    文件:ErrorHandlerDefinitionParserTest.java   
public void testDefaultErrorHandler() {
    DefaultErrorHandlerBuilder errorHandler = ctx.getBean("defaultErrorHandler", DefaultErrorHandlerBuilder.class);
    assertNotNull(errorHandler);
    RedeliveryPolicy policy = errorHandler.getRedeliveryPolicy();
    assertNotNull(policy);
    assertEquals("Wrong maximumRedeliveries", 2, policy.getMaximumRedeliveries());
    assertEquals("Wrong redeliveryDelay", 0, policy.getRedeliveryDelay());
    assertEquals("Wrong logStackTrace", false, policy.isLogStackTrace());

    errorHandler = ctx.getBean("errorHandler", DefaultErrorHandlerBuilder.class);
    assertNotNull(errorHandler);
}
项目:switchyard    文件:DomainCamelContextConfigurationTest.java   
@Produces @Named("foobarErrorHandler")
public ErrorHandlerBuilder getErrorHandler() {
    LOG.info("Creating custom ErrorHandler - " + this);
    return new DefaultErrorHandlerBuilder().disableRedelivery();
}