Add error handling strategy to MessageListenerContainer. There is a protected method to override, but it would be preferable to have a configurable strategy, such as could be provided by an error handler, then I won't have to do this just to get the listener error re-thrown:
protected void handleListenerException(Throwable ex) {
if (!isSessionTransacted()) {
// Log the exceptions in base class if not transactional anyway
super.handleListenerException(ex);
return;
}
logger.debug("Re-throwing exception in container.");
if (ex instanceof RuntimeException) {
// We need to re-throw so that an enclosing non-JMS transaction can
// rollback...
throw (RuntimeException) ex;
}
else if (ex instanceof Error) {
// Just re-throw Error instances because otherwise unit tests just
// swallow exceptions from EasyMock and JUnit.
throw (Error) ex;
}
}
Dave Syer opened SPR-4733 and commented
Add error handling strategy to MessageListenerContainer. There is a protected method to override, but it would be preferable to have a configurable strategy, such as could be provided by an error handler, then I won't have to do this just to get the listener error re-thrown:
Affects: 2.5.2
1 votes, 2 watchers