Class ContextHolderRequestHandlerAdvice
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice
org.springframework.integration.handler.advice.ContextHolderRequestHandlerAdvice
- All Implemented Interfaces:
- Advice,- Interceptor,- MethodInterceptor,- Aware,- BeanFactoryAware,- BeanNameAware,- InitializingBean,- ApplicationContextAware,- ExpressionCapable,- NamedComponent
An 
AbstractRequestHandlerAdvice implementation to store and reset
 a value into/from some context (e.g. ThreadLocal) against a request message.
 The context is populated before callback.execute() and reset after.- Since:
- 6.1
- Author:
- Adel Haidar, Artem Bilan
- 
Nested Class SummaryNested classes/interfaces inherited from class org.springframework.integration.handler.advice.AbstractRequestHandlerAdviceAbstractRequestHandlerAdvice.ExecutionCallback, AbstractRequestHandlerAdvice.ThrowableHolderException
- 
Field SummaryFieldsFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, logger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected ObjectdoInvoke(AbstractRequestHandlerAdvice.ExecutionCallback callback, Object target, Message<?> message) Subclasses implement this method to apply behavior to theMessageHandler.Methods inherited from class org.springframework.integration.handler.advice.AbstractRequestHandlerAdviceinvoke, unwrapExceptionIfNecessary, unwrapThrowableIfNecessaryMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, 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
- 
Field Details- 
valueProvider
- 
contextSetHook
- 
contextClearHook
 
- 
- 
Constructor Details- 
ContextHolderRequestHandlerAdvicepublic ContextHolderRequestHandlerAdvice(Function<Message<?>, Object> valueProvider, Consumer<Object> contextSetHook, Runnable contextClearHook) Construct an instance based on the provided hooks.- Parameters:
- valueProvider- The key provider function.
- contextSetHook- The context set hook consumer.
- contextClearHook- The context clear hook consumer.
 
 
- 
- 
Method Details- 
doInvokeprotected Object doInvoke(AbstractRequestHandlerAdvice.ExecutionCallback callback, Object target, Message<?> message) Description copied from class:AbstractRequestHandlerAdviceSubclasses implement this method to apply behavior to theMessageHandler.callback.execute() invokes the handler method and returns its result, or null. - Specified by:
- doInvokein class- AbstractRequestHandlerAdvice
- 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.
 
 
-