Class AbstractRequestHandlerAdvice
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice
- All Implemented Interfaces:
org.aopalliance.aop.Advice
,org.aopalliance.intercept.Interceptor
,org.aopalliance.intercept.MethodInterceptor
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
,ExpressionCapable
,NamedComponent
- Direct Known Subclasses:
CacheRequestHandlerAdvice
,ExpressionEvaluatingRequestHandlerAdvice
,RateLimiterRequestHandlerAdvice
,RequestHandlerCircuitBreakerAdvice
,RequestHandlerRetryAdvice
public abstract class AbstractRequestHandlerAdvice extends IntegrationObjectSupport implements org.aopalliance.intercept.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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
AbstractRequestHandlerAdvice.ExecutionCallback
Called by subclasses in doInvoke() to proceed() the invocation.protected static class
AbstractRequestHandlerAdvice.ThrowableHolderException
-
Field Summary
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
-
Constructor Summary
Constructors Constructor Description AbstractRequestHandlerAdvice()
-
Method Summary
Modifier and Type Method Description protected abstract java.lang.Object
doInvoke(AbstractRequestHandlerAdvice.ExecutionCallback callback, java.lang.Object target, org.springframework.messaging.Message<?> message)
Subclasses implement this method to apply behavior to theMessageHandler
.java.lang.Object
invoke(org.aopalliance.intercept.MethodInvocation invocation)
protected java.lang.Exception
unwrapExceptionIfNecessary(java.lang.Exception e)
Unwrap the cause of aAbstractRequestHandlerAdvice.ThrowableHolderException
.protected java.lang.Throwable
unwrapThrowableIfNecessary(java.lang.Exception e)
Unwrap the cause of aAbstractRequestHandlerAdvice.ThrowableHolderException
.Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getComponentType, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, onInit, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
-
Constructor Details
-
AbstractRequestHandlerAdvice
public AbstractRequestHandlerAdvice()
-
-
Method Details
-
invoke
public final java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws java.lang.Throwable- Specified by:
invoke
in interfaceorg.aopalliance.intercept.MethodInterceptor
- Throws:
java.lang.Throwable
-
doInvoke
protected abstract java.lang.Object doInvoke(AbstractRequestHandlerAdvice.ExecutionCallback callback, java.lang.Object target, org.springframework.messaging.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
protected java.lang.Exception unwrapExceptionIfNecessary(java.lang.Exception e)Unwrap the cause of aAbstractRequestHandlerAdvice.ThrowableHolderException
.- Parameters:
e
- The exception.- Returns:
- The cause, or e, if not a
AbstractRequestHandlerAdvice.ThrowableHolderException
-
unwrapThrowableIfNecessary
protected java.lang.Throwable unwrapThrowableIfNecessary(java.lang.Exception e)Unwrap the cause of aAbstractRequestHandlerAdvice.ThrowableHolderException
.- Parameters:
e
- The exception.- Returns:
- The cause, or e, if not a
AbstractRequestHandlerAdvice.ThrowableHolderException
-