Class XPathRouter

All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>, Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Ordered, ExpressionCapable, Orderable, IntegrationPattern, MessageRouter, NamedComponent, IntegrationManagement, MappingMessageRouterManagement, TrackableComponent, MessageHandler, reactor.core.CoreSubscriber<Message<?>>

public class XPathRouter extends AbstractMappingMessageRouter
Message Router that uses XPathExpression evaluation to determine channel names.
Jonas Partner, Oleg Zhurakousky
  • Constructor Details

    • XPathRouter

      public XPathRouter(String expression, Map<String,String> namespaces)
      Create a router that uses an XPath expression. The expression may contain zero or more namespace prefixes.
      expression - the XPath expression as a String
      namespaces - map of namespaces with prefixes as the map keys
    • XPathRouter

      public XPathRouter(String expression, String prefix, String namespace)
      Create a router uses an XPath expression with one namespace. For example, expression='/ns1:one/@type' prefix='ns1' namespace=''
      expression - the XPath expression as a String
      prefix - namespace prefix
      namespace - namespace uri
    • XPathRouter

      public XPathRouter(String expression)
      Create a router that uses an XPath expression with no namespaces. For example '/one/@type'
      expression - the XPath expression as a String
    • XPathRouter

      public XPathRouter(XPathExpression expression)
      Create a router that uses the provided XPath expression.
      expression - the XPath expression
  • Method Details

    • setEvaluateAsString

      public void setEvaluateAsString(boolean evaluateAsString)
    • setConverter

      public void setConverter(XmlPayloadConverter converter)
      Specify the Converter to use when converting payloads prior to XPath evaluation.
      converter - The payload converter.
    • getComponentType

      public String getComponentType()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this method to provide component type information.
      Specified by:
      getComponentType in interface NamedComponent
      getComponentType in class AbstractMessageRouter
    • getChannelKeys

      protected List<Object> getChannelKeys(Message<?> message)
      Description copied from class: AbstractMappingMessageRouter
      Subclasses must implement this method to return the channel keys. A "key" might be present in this router's "channelMappings", or it could be the channel's name or even the Message Channel instance itself.
      Specified by:
      getChannelKeys in class AbstractMappingMessageRouter
      message - The message.
      The channel keys.