public class ExpressionEvaluatingRoutingSlipRouteStrategy extends Object implements RoutingSlipRouteStrategy, BeanFactoryAware, InitializingBean
Expression
based RoutingSlipRouteStrategy
implementation.
The requestMessage
and reply
object are wrapped
to the ExpressionEvaluatingRoutingSlipRouteStrategy.RequestAndReply
which is used as a EvaluationContext
rootObject
.
This is necessary to avoid a creation of a new EvaluationContext
on each invocation
when additional parameter can be populated as expression variable, but EvaluationContext
isn't thread-safe.
The ExpressionEvaluatingRoutingSlipRouteStrategy
can be used directly as a regular bean
in the ApplicationContext
and its beanName
can be used from routingSlip
header configuration.
Usage of ExpressionEvaluatingRoutingSlipRouteStrategy
as a regular bean definition is
a recommended way in case of distributed environment, when message with routingSlip
header can be sent across the network. One of this case is a QueueChannel
with
persistent MessageStore
, when ExpressionEvaluatingRoutingSlipRouteStrategy
instance as a header value will be non-serializable.
This class is used internally from RoutingSlipHeaderValueMessageProcessor
to populate routingSlip
header value item, when the value
from configuration contains expression definitions:
<header-enricher>
<routing-slip
value="channel1; @routingSlipPojo.get(request, reply); request.headers[foo]"/>
</header-enricher>
Modifier and Type | Class and Description |
---|---|
static class |
ExpressionEvaluatingRoutingSlipRouteStrategy.RequestAndReply |
Constructor and Description |
---|
ExpressionEvaluatingRoutingSlipRouteStrategy(Expression expression) |
ExpressionEvaluatingRoutingSlipRouteStrategy(String expression) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
Object |
getNextPath(Message<?> requestMessage,
Object reply) |
void |
setBeanFactory(BeanFactory beanFactory) |
void |
setIntegrationEvaluationContext(EvaluationContext evaluationContext) |
String |
toString() |
public ExpressionEvaluatingRoutingSlipRouteStrategy(String expression)
public ExpressionEvaluatingRoutingSlipRouteStrategy(Expression expression)
public void setIntegrationEvaluationContext(EvaluationContext evaluationContext)
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public Object getNextPath(Message<?> requestMessage, Object reply)
getNextPath
in interface RoutingSlipRouteStrategy