Class ExpressionEvaluatingRoutingSlipRouteStrategy
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,InitializingBean
,RoutingSlipRouteStrategy
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>
- Since:
- 4.1
- Author:
- Artem Bilan, Gary Russell
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExpressionEvaluatingRoutingSlipRouteStrategy.RequestAndReply
-
Constructor Summary
Constructors Constructor Description ExpressionEvaluatingRoutingSlipRouteStrategy(String expression)
ExpressionEvaluatingRoutingSlipRouteStrategy(Expression expression)
-
Method Summary
Modifier and Type Method Description void
afterPropertiesSet()
Object
getNextPath(Message<?> requestMessage, Object reply)
Get the next path for this routing slip.void
setBeanFactory(BeanFactory beanFactory)
void
setIntegrationEvaluationContext(EvaluationContext evaluationContext)
String
toString()
-
Constructor Details
-
Method Details
-
setIntegrationEvaluationContext
-
setBeanFactory
- Specified by:
setBeanFactory
in interfaceBeanFactoryAware
- Throws:
BeansException
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceInitializingBean
-
getNextPath
Description copied from interface:RoutingSlipRouteStrategy
Get the next path for this routing slip.- Specified by:
getNextPath
in interfaceRoutingSlipRouteStrategy
- Parameters:
requestMessage
- the request message.reply
- the reply - depending on context, this may be a user-level domain object, aMessage
or aAbstractIntegrationMessageBuilder
.- Returns:
- a channel name or another
RoutingSlipRouteStrategy
.
-
toString
-