Class MethodInvokingMessageProcessor<T>
java.lang.Object
org.springframework.integration.util.AbstractExpressionEvaluator
org.springframework.integration.handler.AbstractMessageProcessor<T>
org.springframework.integration.handler.MethodInvokingMessageProcessor<T>
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,InitializingBean
,Lifecycle
,MessageProcessor<T>
,ManageableLifecycle
public class MethodInvokingMessageProcessor<T> extends AbstractMessageProcessor<T> implements ManageableLifecycle
A MessageProcessor implementation that invokes a method on a target Object.
The Method instance or method name may be provided as a constructor argument.
If a method name is provided, and more than one declared method has that name,
the method-selection will be dynamic, based on the underlying SpEL method resolution.
Alternatively, an annotation type may be provided so that the candidates for
SpEL's method resolution are determined by the presence of that
annotation rather than the method name.
- Since:
- 2.0
- Author:
- Dave Syer, Artem Bilan, Gary Russell
-
Field Summary
Fields inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
EXPRESSION_PARSER, logger
-
Constructor Summary
Constructors Constructor Description MethodInvokingMessageProcessor(Object targetObject, Class<? extends Annotation> annotationType)
MethodInvokingMessageProcessor(Object targetObject, Method method)
MethodInvokingMessageProcessor(Object targetObject, String methodName)
MethodInvokingMessageProcessor(Object targetObject, String methodName, boolean canProcessMessageList)
-
Method Summary
Modifier and Type Method Description boolean
isRunning()
T
processMessage(Message<?> message)
Process the Message and return a value (or null).void
setBeanFactory(BeanFactory beanFactory)
Specify a BeanFactory in order to enable resolution via@beanName
in the expression.void
setConversionService(ConversionService conversionService)
void
setUseSpelInvoker(boolean useSpelInvoker)
Aboolean
flag to use SpEL Expression evaluation orInvocableHandlerMethod
for target method invocation.void
start()
void
stop()
Methods inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
afterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getBeanFactory, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, onInit
-
Constructor Details
-
MethodInvokingMessageProcessor
-
MethodInvokingMessageProcessor
-
MethodInvokingMessageProcessor
-
MethodInvokingMessageProcessor
public MethodInvokingMessageProcessor(Object targetObject, Class<? extends Annotation> annotationType)
-
-
Method Details
-
setConversionService
- Overrides:
setConversionService
in classAbstractExpressionEvaluator
-
setBeanFactory
Description copied from class:AbstractExpressionEvaluator
Specify a BeanFactory in order to enable resolution via@beanName
in the expression.- Specified by:
setBeanFactory
in interfaceBeanFactoryAware
- Overrides:
setBeanFactory
in classAbstractExpressionEvaluator
-
setUseSpelInvoker
public void setUseSpelInvoker(boolean useSpelInvoker)Aboolean
flag to use SpEL Expression evaluation orInvocableHandlerMethod
for target method invocation.- Parameters:
useSpelInvoker
- to use SpEL Expression evaluation or not.- Since:
- 5.0
-
start
public void start()- Specified by:
start
in interfaceLifecycle
- Specified by:
start
in interfaceManageableLifecycle
-
stop
public void stop()- Specified by:
stop
in interfaceLifecycle
- Specified by:
stop
in interfaceManageableLifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceLifecycle
- Specified by:
isRunning
in interfaceManageableLifecycle
-
processMessage
Description copied from interface:MessageProcessor
Process the Message and return a value (or null).- Specified by:
processMessage
in interfaceMessageProcessor<T>
- Specified by:
processMessage
in classAbstractMessageProcessor<T>
- Parameters:
message
- The message to process.- Returns:
- The result.
-