public class ExpressionEvaluatingRequestHandlerAdvice extends AbstractRequestHandlerAdvice
MessageHandlers.
Two expressions 'onSuccessExpression' and 'onFailureExpression' are evaluated when
appropriate. If the evaluation returns a result, a message is sent to the onSuccessChannel
or onFailureChannel as appropriate; the message is an AdviceMessage
containing the evaluation result in its payload and the inputMessage property containing
the original message that was sent to the endpoint.
The failure expression is NOT evaluated if the success expression throws an exception.| Modifier and Type | Class and Description |
|---|---|
static class |
ExpressionEvaluatingRequestHandlerAdvice.MessageHandlingExpressionEvaluatingAdviceException |
AbstractRequestHandlerAdvice.ExecutionCallbacklogger| Constructor and Description |
|---|
ExpressionEvaluatingRequestHandlerAdvice() |
| Modifier and Type | Method and Description |
|---|---|
protected StandardEvaluationContext |
createEvaluationContext() |
protected Object |
doInvoke(AbstractRequestHandlerAdvice.ExecutionCallback callback,
Object target,
Message<?> message)
Subclasses implement this method to apply behavior to the
MessageHandler. |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
void |
setFailureChannel(MessageChannel failureChannel) |
void |
setOnFailureExpression(Expression onFailureExpression) |
void |
setOnFailureExpression(String onFailureExpression) |
void |
setOnSuccessExpression(Expression onSuccessExpression) |
void |
setOnSuccessExpression(String onSuccessExpression) |
void |
setPropagateEvaluationFailures(boolean propagateOnSuccessEvaluationFailures)
If true and an onSuccess expression evaluation fails with an exception, the exception will be thrown to the
caller.
|
void |
setReturnFailureExpressionResult(boolean returnFailureExpressionResult)
If true, the result of evaluating the onFailureExpression will
be returned as the result of AbstractReplyProducingMessageHandler.handleRequestMessage(Message).
|
void |
setSuccessChannel(MessageChannel successChannel) |
void |
setTrapException(boolean trapException)
If true, any exception will be caught and null returned.
|
invoke, unwrapExceptionIfNecessary, unwrapThrowableIfNecessaryafterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getComponentName, getComponentType, getConversionService, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, setMessageBuilderFactory, setTaskScheduler, toStringpublic ExpressionEvaluatingRequestHandlerAdvice()
public void setOnSuccessExpression(String onSuccessExpression)
public void setOnSuccessExpression(Expression onSuccessExpression)
public void setOnFailureExpression(String onFailureExpression)
public void setOnFailureExpression(Expression onFailureExpression)
public void setSuccessChannel(MessageChannel successChannel)
public void setFailureChannel(MessageChannel failureChannel)
public void setTrapException(boolean trapException)
trapException - true to trap Exceptions.public void setReturnFailureExpressionResult(boolean returnFailureExpressionResult)
returnFailureExpressionResult - true to return the result of the evaluation.public void setPropagateEvaluationFailures(boolean propagateOnSuccessEvaluationFailures)
propagateOnSuccessEvaluationFailures - The propagateOnSuccessEvaluationFailures to set.protected void onInit()
throws Exception
IntegrationObjectSupportonInit in class IntegrationObjectSupportException - Any exception.protected Object doInvoke(AbstractRequestHandlerAdvice.ExecutionCallback callback, Object target, Message<?> message) throws Exception
AbstractRequestHandlerAdviceMessageHandler.
callback.execute() invokes the handler method and returns its result, or null.
doInvoke in class AbstractRequestHandlerAdvicecallback - 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.MessageHandler.Exception - Any Exception.protected StandardEvaluationContext createEvaluationContext()