Class XPathRouter

java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.router.AbstractMessageRouter
org.springframework.integration.router.AbstractMappingMessageRouter
org.springframework.integration.xml.router.XPathRouter
All Implemented Interfaces:
org.reactivestreams.Subscriber<org.springframework.messaging.Message<?>>, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.core.Ordered, org.springframework.integration.context.ExpressionCapable, org.springframework.integration.context.Orderable, org.springframework.integration.IntegrationPattern, org.springframework.integration.router.MessageRouter, org.springframework.integration.support.context.NamedComponent, org.springframework.integration.support.management.IntegrationManagement, org.springframework.integration.support.management.MappingMessageRouterManagement, org.springframework.integration.support.management.TrackableComponent, org.springframework.messaging.MessageHandler, reactor.core.CoreSubscriber<org.springframework.messaging.Message<?>>

public class XPathRouter extends org.springframework.integration.router.AbstractMappingMessageRouter
Message Router that uses XPathExpression evaluation to determine channel names.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement

    org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides
  • Field Summary

    Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport

    EXPRESSION_PARSER, logger

    Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement

    METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    XPathRouter(String expression)
    Create a router that uses an XPath expression with no namespaces.
    XPathRouter(String expression, String prefix, String namespace)
    Create a router uses an XPath expression with one namespace.
    XPathRouter(String expression, Map<String,String> namespaces)
    Create a router that uses an XPath expression.
    XPathRouter(org.springframework.xml.xpath.XPathExpression expression)
    Create a router that uses the provided XPath expression.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected List<Object>
    getChannelKeys(org.springframework.messaging.Message<?> message)
     
     
    void
    Specify the Converter to use when converting payloads prior to XPath evaluation.
    void
    setEvaluateAsString(boolean evaluateAsString)
     

    Methods inherited from class org.springframework.integration.router.AbstractMappingMessageRouter

    determineTargetChannels, getChannelMappings, getDynamicChannelNames, onInit, removeChannelMapping, replaceChannelMappings, setChannelKeyFallback, setChannelMapping, setChannelMappings, setDefaultOutputChannel, setDefaultOutputChannelName, setDynamicChannelLimit, setPrefix, setResolutionRequired, setSuffix

    Methods inherited from class org.springframework.integration.router.AbstractMessageRouter

    getDefaultOutputChannel, getIntegrationPatternType, getMessagingTemplate, getRequiredConversionService, handleMessageInternal, setApplySequence, setIgnoreSendFailures, setSendTimeout

    Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler

    handleMessage, onComplete, onError, onNext, onSubscribe, setObservationConvention

    Methods inherited from class org.springframework.integration.handler.MessageHandlerSupport

    buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack

    Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport

    afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface reactor.core.CoreSubscriber

    currentContext

    Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement

    getThisAs

    Methods inherited from interface org.springframework.integration.support.context.NamedComponent

    getBeanName, getComponentName
  • 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.
      Parameters:
      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='www.example.org'
      Parameters:
      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'
      Parameters:
      expression - the XPath expression as a String
    • XPathRouter

      public XPathRouter(org.springframework.xml.xpath.XPathExpression expression)
      Create a router that uses the provided XPath expression.
      Parameters:
      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.
      Parameters:
      converter - The payload converter.
    • getComponentType

      public String getComponentType()
      Specified by:
      getComponentType in interface org.springframework.integration.support.context.NamedComponent
      Overrides:
      getComponentType in class org.springframework.integration.router.AbstractMessageRouter
    • getChannelKeys

      protected List<Object> getChannelKeys(org.springframework.messaging.Message<?> message)
      Specified by:
      getChannelKeys in class org.springframework.integration.router.AbstractMappingMessageRouter