From 616a48acc2e030ff9503ebfd3fec391ade77e3da Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Wed, 23 Sep 2009 22:06:46 +0000 Subject: [PATCH] SPR-6142 AbstractMessageListenerContainer now accepts an implementation of the ErrorHandler strategy for handling any uncaught exceptions thrown while processing a Message. The default behavior is still to log at error-level only (no ErrorHandler). --- .../AbstractMessageListenerContainer.java | 38 +++++++++-- .../SimpleMessageListenerContainerTests.java | 63 ++++++++++++++++++- 2 files changed, 96 insertions(+), 5 deletions(-) diff --git a/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java b/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java index 6abdb07aa9f..00bde493bb6 100644 --- a/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java +++ b/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import javax.jms.Topic; import org.springframework.jms.support.JmsUtils; import org.springframework.util.Assert; +import org.springframework.util.ErrorHandler; /** * Abstract base class for message listener containers. Can either host @@ -44,7 +45,11 @@ import org.springframework.util.Assert; * is to never propagate an exception thrown by a message listener up to * the JMS provider. Instead, it will log any such exception at the error level. * This means that from the perspective of the attendant JMS provider no such - * listener will ever fail. + * listener will ever fail. However, if error handling is necessary, then + * any implementation of the {@link ErrorHandler} strategy may be provided to + * the {@link #setErrorHandler(ErrorHandler)} method. Note that JMSExceptions + * will be passed to the ErrorHandler in addition to (but after) being + * passed to an {@link ExceptionListener}, if one has been provided. * *

The listener container offers the following message acknowledgment options: *