Class ExpressionEvaluatingRoutingSlipRouteStrategy

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

public class ExpressionEvaluatingRoutingSlipRouteStrategy
extends java.lang.Object
implements RoutingSlipRouteStrategy, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.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
  • Constructor Details

  • Method Details

    • setIntegrationEvaluationContext

      public void setIntegrationEvaluationContext​(org.springframework.expression.EvaluationContext evaluationContext)
    • setBeanFactory

      public void setBeanFactory​(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
      Specified by:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
      Throws:
      org.springframework.beans.BeansException
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • getNextPath

      public java.lang.Object getNextPath​(org.springframework.messaging.Message<?> requestMessage, java.lang.Object reply)
      Description copied from interface: RoutingSlipRouteStrategy
      Get the next path for this routing slip.
      Specified by:
      getNextPath in interface RoutingSlipRouteStrategy
      Parameters:
      requestMessage - the request message.
      reply - the reply - depending on context, this may be a user-level domain object, a Message or a AbstractIntegrationMessageBuilder.
      Returns:
      a channel name or another RoutingSlipRouteStrategy.
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object