Skip to content

Commit

Permalink
CAMEL-7050: DeadLetterChannel should make more clear that it handles …
Browse files Browse the repository at this point in the history
…any new exception also. Added option to configure this behavior so ppl can turn that off and let new exceptions be unhandled, so transactions can rollback.
  • Loading branch information
davsclaus committed Jan 18, 2015
1 parent 42ded87 commit 4136f92
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Expand Up @@ -44,6 +44,8 @@ public class CamelErrorHandlerFactoryBean extends AbstractCamelFactoryBean<Error
@XmlAttribute
private String deadLetterUri;
@XmlAttribute
private Boolean deadLetterHandleNewException;
@XmlAttribute
private LoggingLevel level;
@XmlAttribute
private String logName;
Expand All @@ -70,6 +72,9 @@ public ErrorHandlerBuilder getObject() throws Exception {
if (deadLetterUri != null) {
handler.setDeadLetterUri(deadLetterUri);
}
if (deadLetterHandleNewException != null) {
handler.setDeadLetterHandleNewException(deadLetterHandleNewException);
}
if (useOriginalMessage != null) {
handler.setUseOriginalMessage(useOriginalMessage);
}
Expand Down
Expand Up @@ -38,6 +38,8 @@ public class ErrorHandlerDefinition extends IdentifiedType {
@XmlAttribute
private String deadLetterUri;
@XmlAttribute
private String deadLetterHandleNewException;
@XmlAttribute
private LoggingLevel level;
@XmlAttribute
private LoggingLevel rollbackLoggingLevel;
Expand Down
Expand Up @@ -114,6 +114,11 @@ protected void doParse(Element element, ParserContext parserContext, BeanDefinit
throw new IllegalArgumentException("Attribute deadLetterUri can only be used if type is "
+ ErrorHandlerType.DeadLetterChannel.name() + ", in error handler with id: " + id);
}
String deadLetterHandleNewException = element.getAttribute("deadLetterHandleNewException");
if (ObjectHelper.isNotEmpty(deadLetterHandleNewException) && !type.equals(ErrorHandlerType.DeadLetterChannel)) {
throw new IllegalArgumentException("Attribute deadLetterHandleNewException can only be used if type is "
+ ErrorHandlerType.DeadLetterChannel.name() + ", in error handler with id: " + id);
}
String transactionTemplateRef = element.getAttribute("transactionTemplateRef");
if (ObjectHelper.isNotEmpty(transactionTemplateRef) && !type.equals(ErrorHandlerType.TransactionErrorHandler)) {
throw new IllegalArgumentException("Attribute transactionTemplateRef can only be used if type is "
Expand Down

0 comments on commit 4136f92

Please sign in to comment.