use of org.apache.camel.cdi.xml.RedeliveryPolicyFactoryBean in project camel by apache.
the class XmlErrorHandlerFactoryBean method setProperties.
private void setProperties(DefaultErrorHandlerBuilder builder) throws Exception {
if (nonNull(handler.getDeadLetterHandleNewException())) {
builder.setDeadLetterHandleNewException(handler.getDeadLetterHandleNewException());
}
builder.setDeadLetterUri(handler.getDeadLetterUri());
builder.setExecutorServiceRef(handler.getExecutorServiceRef());
builder.setRetryWhileRef(handler.getRetryWhileRef());
if (nonNull(handler.getUseOriginalMessage())) {
builder.setUseOriginalMessage(handler.getUseOriginalMessage());
}
if (isNotEmpty(handler.getOnExceptionOccurredRef())) {
Processor processor = getReferenceByName(manager, handler.getOnExceptionOccurredRef(), Processor.class).orElseThrow(() -> new UnsatisfiedResolutionException(format("No bean with name [%s] to satisfy attribute [%s]", handler.getOnPrepareFailureRef(), "onExceptionOccurredRef")));
builder.setOnExceptionOccurred(processor);
}
if (isNotEmpty(handler.getOnPrepareFailureRef())) {
Processor processor = getReferenceByName(manager, handler.getOnPrepareFailureRef(), Processor.class).orElseThrow(() -> new UnsatisfiedResolutionException(format("No bean with name [%s] to satisfy attribute [%s]", handler.getOnPrepareFailureRef(), "onPrepareFailureRef")));
builder.setOnPrepareFailure(processor);
}
if (isNotEmpty(handler.getOnRedeliveryRef())) {
Processor processor = getReferenceByName(manager, handler.getOnRedeliveryRef(), Processor.class).orElseThrow(() -> new UnsatisfiedResolutionException(format("No bean with name [%s] to satisfy attribute [%s]", handler.getOnPrepareFailureRef(), "onRedeliveryRef")));
builder.setOnRedelivery(processor);
}
if (nonNull(handler.getRedeliveryPolicy())) {
RedeliveryPolicyFactoryBean policy = handler.getRedeliveryPolicy();
policy.setBeanManager(manager);
builder.setRedeliveryPolicy(policy.getObject());
}
if (isNotEmpty(handler.getRedeliveryPolicyRef())) {
RedeliveryPolicy policy = getReferenceByName(manager, handler.getRedeliveryPolicyRef(), RedeliveryPolicy.class).orElseThrow(() -> new UnsatisfiedResolutionException(format("No bean with name [%s] to satisfy attribute [%s]", handler.getRedeliveryPolicyRef(), "redeliveryPolicyRef")));
builder.setRedeliveryPolicy(policy);
}
}
Aggregations