Class ExpressionEvaluatingRoutingSlipRouteStrategy

java.lang.Object
org.springframework.integration.routingslip.ExpressionEvaluatingRoutingSlipRouteStrategy
All Implemented Interfaces:
Aware, BeanFactoryAware, InitializingBean, RoutingSlipRouteStrategy

public class ExpressionEvaluatingRoutingSlipRouteStrategy
extends Object
implements RoutingSlipRouteStrategy, BeanFactoryAware, InitializingBean
The 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