Class StatefulRetryOperationsInterceptorFactoryBean
java.lang.Object
org.springframework.amqp.rabbit.config.AbstractRetryOperationsInterceptorFactoryBean
org.springframework.amqp.rabbit.config.StatefulRetryOperationsInterceptorFactoryBean
- All Implemented Interfaces:
FactoryBean<Advice>
public class StatefulRetryOperationsInterceptorFactoryBean
extends AbstractRetryOperationsInterceptorFactoryBean
Convenient factory bean for creating a stateful retry interceptor for use in a message listener container, giving you
a large amount of control over the behavior of a container when a listener fails. To control the number of retry
attempts or the backoff in between attempts, supply a customized
RetryPolicy
. Stateful retry is appropriate
if your listener is using a transactional resource that needs to be rolled back on an exception (e.g., a stateful
connection to a back end server). JPA is the canonical example. The semantics of stateful retry mean that a listener
exception is propagated to the container so that it can force a rollback. When the message is redelivered it has to
be recognised (hence the MessageKeyGenerator
strategy), and when the retry attempts are exhausted it will be
processed using a MessageRecoverer
if one is provided, in a new transaction. If a recoverer is not provided,
the message will be logged and dropped.- Author:
- Dave Syer, Gary Russell, Ngoc Nhan, Artem Bilan, Stephane Nicoll
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClass
<?> void
setMessageKeyGenerator
(MessageKeyGenerator messageKeyGenerator) void
setNewMessageIdentifier
(NewMessageIdentifier newMessageIdentifier) void
setStateCacheSize
(int stateCacheSize) Methods inherited from class org.springframework.amqp.rabbit.config.AbstractRetryOperationsInterceptorFactoryBean
getMessageRecoverer, getRetryPolicy, setMessageRecoverer, setRetryPolicy
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.FactoryBean
isSingleton
-
Constructor Details
-
StatefulRetryOperationsInterceptorFactoryBean
public StatefulRetryOperationsInterceptorFactoryBean()
-
-
Method Details
-
setMessageKeyGenerator
-
setNewMessageIdentifier
-
setStateCacheSize
public void setStateCacheSize(int stateCacheSize) -
getObject
-
getObjectType
-