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<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.- Author:
- Jonas Partner, Oleg Zhurakousky
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
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(XPathExpression expression)
Create a router that uses the provided XPath expression. -
Method Summary
Modifier and Type Method Description protected List<Object>
getChannelKeys(Message<?> message)
Subclasses must implement this method to return the channel keys.String
getComponentType()
Subclasses may implement this method to provide component type information.void
setConverter(XmlPayloadConverter converter)
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, removeChannelMapping, replaceChannelMappings, setChannelKeyFallback, setChannelMapping, setChannelMappings, setDynamicChannelLimit, setPrefix, setResolutionRequired, setSuffix
Methods inherited from class org.springframework.integration.router.AbstractMessageRouter
getDefaultOutputChannel, getIntegrationPatternType, getMessagingTemplate, getRequiredConversionService, handleMessageInternal, onInit, setApplySequence, setDefaultOutputChannel, setDefaultOutputChannelName, setIgnoreSendFailures, setSendTimeout
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribe
Methods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, 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, getIntegrationProperty, 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 org.springframework.integration.support.management.IntegrationManagement
getThisAs
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
XPathRouter
Create a router that uses an XPath expression. The expression may contain zero or more namespace prefixes.- Parameters:
expression
- the XPath expression as a Stringnamespaces
- map of namespaces with prefixes as the map keys
-
XPathRouter
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 Stringprefix
- namespace prefixnamespace
- namespace uri
-
XPathRouter
Create a router that uses an XPath expression with no namespaces. For example '/one/@type'- Parameters:
expression
- the XPath expression as a String
-
XPathRouter
Create a router that uses the provided XPath expression.- Parameters:
expression
- the XPath expression
-
-
Method Details
-
setEvaluateAsString
public void setEvaluateAsString(boolean evaluateAsString) -
setConverter
Specify the Converter to use when converting payloads prior to XPath evaluation.- Parameters:
converter
- The payload converter.
-
getComponentType
Description copied from class:IntegrationObjectSupport
Subclasses may implement this method to provide component type information.- Specified by:
getComponentType
in interfaceNamedComponent
- Overrides:
getComponentType
in classAbstractMessageRouter
-
getChannelKeys
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 classAbstractMappingMessageRouter
- Parameters:
message
- The message.- Returns:
- The channel keys.
-