Class AbstractRequestHandlerAdvice
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice
- All Implemented Interfaces:
Advice
,Interceptor
,MethodInterceptor
,Aware
,BeanFactoryAware
,BeanNameAware
,InitializingBean
,ApplicationContextAware
,ComponentSourceAware
,ExpressionCapable
,NamedComponent
- Direct Known Subclasses:
CacheRequestHandlerAdvice
,ContextHolderRequestHandlerAdvice
,ExpressionEvaluatingRequestHandlerAdvice
,LockRequestHandlerAdvice
,RateLimiterRequestHandlerAdvice
,RequestHandlerCircuitBreakerAdvice
,RequestHandlerRetryAdvice
public abstract class AbstractRequestHandlerAdvice
extends IntegrationObjectSupport
implements MethodInterceptor
Base class for
MessageHandler
advice classes. Subclasses should provide an
implementation for doInvoke(ExecutionCallback, Object, Message)
. Used to
advise the handleRequestMessage method for
AbstractReplyProducingMessageHandler
or
MessageHandler.handleMessage(Message)
for other message handlers.- Since:
- 2.2
- Author:
- Gary Russell, Artem Bilan, Ngoc Nhan
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interface
Called by subclasses indoInvoke(org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice.ExecutionCallback, java.lang.Object, org.springframework.messaging.Message<?>)
toproceed()
the invocation.protected static final class
-
Field Summary
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract @Nullable Object
doInvoke
(AbstractRequestHandlerAdvice.ExecutionCallback callback, Object target, Message<?> message) Subclasses implement this method to apply behavior to theMessageHandler
.final @Nullable Object
invoke
(MethodInvocation invocation) protected Exception
unwrapExceptionIfNecessary
(Exception exception) Unwrap the cause of aAbstractRequestHandlerAdvice.ThrowableHolderException
.protected Throwable
Unwrap the cause of aAbstractRequestHandlerAdvice.ThrowableHolderException
.Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, onInit, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
-
Constructor Details
-
AbstractRequestHandlerAdvice
public AbstractRequestHandlerAdvice()
-
-
Method Details
-
invoke
- Specified by:
invoke
in interfaceMethodInterceptor
- Throws:
Throwable
-
getComponentType
- Specified by:
getComponentType
in interfaceNamedComponent
-
doInvoke
protected abstract @Nullable Object doInvoke(AbstractRequestHandlerAdvice.ExecutionCallback callback, Object target, Message<?> message) Subclasses implement this method to apply behavior to theMessageHandler
.callback.execute() invokes the handler method and returns its result, or null.
- Parameters:
callback
- Subclasses invoke the execute() method on this interface to invoke the handler method.target
- The target handler.message
- The message that will be sent to the handler.- Returns:
- the result after invoking the
MessageHandler
.
-
unwrapExceptionIfNecessary
Unwrap the cause of aAbstractRequestHandlerAdvice.ThrowableHolderException
.- Parameters:
exception
- The exception.- Returns:
- The cause, or exception, if not a
AbstractRequestHandlerAdvice.ThrowableHolderException
-
unwrapThrowableIfNecessary
Unwrap the cause of aAbstractRequestHandlerAdvice.ThrowableHolderException
.- Parameters:
e
- The exception.- Returns:
- The cause, or e, if not a
AbstractRequestHandlerAdvice.ThrowableHolderException
-