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 behaviour of a container when a listener fails. To control the number of retry attempt or the backoff in between attempts, supply a customizedRetryTemplate. Stateful retry is appropriate if your listener is using a transactional resource that needs to be rollback 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 theMessageKeyGeneratorstrategy), and when the retry attempts are exhausted it will be processed using aMessageRecovererif 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
- See Also:
RetryOperations.execute(org.springframework.retry.RetryCallback, org.springframework.retry.RecoveryCallback, org.springframework.retry.RetryState)
-
-
Field Summary
-
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
-
Constructor Summary
Constructors Constructor Description StatefulRetryOperationsInterceptorFactoryBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.retry.interceptor.StatefulRetryOperationsInterceptorgetObject()java.lang.Class<?>getObjectType()booleanisSingleton()voidsetMessageKeyGenerator(MessageKeyGenerator messageKeyGeneretor)voidsetNewMessageIdentifier(NewMessageIdentifier newMessageIdentifier)-
Methods inherited from class org.springframework.amqp.rabbit.config.AbstractRetryOperationsInterceptorFactoryBean
getMessageRecoverer, getRetryOperations, setMessageRecoverer, setRetryOperations
-
-
-
-
Method Detail
-
setMessageKeyGenerator
public void setMessageKeyGenerator(MessageKeyGenerator messageKeyGeneretor)
-
setNewMessageIdentifier
public void setNewMessageIdentifier(NewMessageIdentifier newMessageIdentifier)
-
getObject
public org.springframework.retry.interceptor.StatefulRetryOperationsInterceptor getObject()
-
getObjectType
public java.lang.Class<?> getObjectType()
-
isSingleton
public boolean isSingleton()
- Specified by:
isSingletonin interfaceFactoryBean<Advice>- Overrides:
isSingletonin classAbstractRetryOperationsInterceptorFactoryBean
-
-