Search in sources :

Example 1 with RedeliveryErrorHandler

use of org.apache.camel.processor.RedeliveryErrorHandler in project camel by apache.

the class ErrorHandlerBuilderSupport method configure.

public void configure(RouteContext routeContext, ErrorHandler handler) {
    if (handler instanceof ErrorHandlerSupport) {
        ErrorHandlerSupport handlerSupport = (ErrorHandlerSupport) handler;
        List<OnExceptionDefinition> list = onExceptions.get(routeContext);
        if (list != null) {
            for (OnExceptionDefinition exception : list) {
                handlerSupport.addExceptionPolicy(routeContext, exception);
            }
        }
    }
    if (handler instanceof RedeliveryErrorHandler) {
        boolean original = ((RedeliveryErrorHandler) handler).isUseOriginalMessagePolicy();
        if (original) {
            // ensure allow original is turned on
            routeContext.setAllowUseOriginalMessage(true);
        }
    }
}
Also used : RedeliveryErrorHandler(org.apache.camel.processor.RedeliveryErrorHandler) ErrorHandlerSupport(org.apache.camel.processor.ErrorHandlerSupport) OnExceptionDefinition(org.apache.camel.model.OnExceptionDefinition)

Example 2 with RedeliveryErrorHandler

use of org.apache.camel.processor.RedeliveryErrorHandler in project camel by apache.

the class ManagedErrorHandler method setLogHandled.

public void setLogHandled(Boolean log) {
    if (!isSupportRedelivery()) {
        throw new IllegalArgumentException("This error handler does not support redelivery");
    }
    RedeliveryErrorHandler redelivery = (RedeliveryErrorHandler) errorHandler;
    redelivery.getRedeliveryPolicy().setLogHandled(log);
}
Also used : RedeliveryErrorHandler(org.apache.camel.processor.RedeliveryErrorHandler)

Example 3 with RedeliveryErrorHandler

use of org.apache.camel.processor.RedeliveryErrorHandler in project camel by apache.

the class ManagedErrorHandler method setUseExponentialBackOff.

public void setUseExponentialBackOff(Boolean backoff) {
    if (!isSupportRedelivery()) {
        throw new IllegalArgumentException("This error handler does not support redelivery");
    }
    RedeliveryErrorHandler redelivery = (RedeliveryErrorHandler) errorHandler;
    redelivery.getRedeliveryPolicy().setUseExponentialBackOff(backoff);
}
Also used : RedeliveryErrorHandler(org.apache.camel.processor.RedeliveryErrorHandler)

Example 4 with RedeliveryErrorHandler

use of org.apache.camel.processor.RedeliveryErrorHandler in project camel by apache.

the class ManagedErrorHandler method setMaximumRedeliveries.

public void setMaximumRedeliveries(Integer maximum) {
    if (!isSupportRedelivery()) {
        throw new IllegalArgumentException("This error handler does not support redelivery");
    }
    RedeliveryErrorHandler redelivery = (RedeliveryErrorHandler) errorHandler;
    redelivery.getRedeliveryPolicy().setMaximumRedeliveries(maximum);
}
Also used : RedeliveryErrorHandler(org.apache.camel.processor.RedeliveryErrorHandler)

Example 5 with RedeliveryErrorHandler

use of org.apache.camel.processor.RedeliveryErrorHandler in project camel by apache.

the class ManagedErrorHandler method setLogStackTrace.

public void setLogStackTrace(Boolean log) {
    if (!isSupportRedelivery()) {
        throw new IllegalArgumentException("This error handler does not support redelivery");
    }
    RedeliveryErrorHandler redelivery = (RedeliveryErrorHandler) errorHandler;
    redelivery.getRedeliveryPolicy().setLogStackTrace(log);
}
Also used : RedeliveryErrorHandler(org.apache.camel.processor.RedeliveryErrorHandler)

Aggregations

RedeliveryErrorHandler (org.apache.camel.processor.RedeliveryErrorHandler)21 OnExceptionDefinition (org.apache.camel.model.OnExceptionDefinition)1 ErrorHandlerSupport (org.apache.camel.processor.ErrorHandlerSupport)1