Class MethodInvokingRouter
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.router.MethodInvokingRouter
- 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.context.Lifecycle,org.springframework.core.Ordered,ExpressionCapable,Orderable,IntegrationPattern,MessageRouter,NamedComponent,IntegrationManagement,ManageableLifecycle,MappingMessageRouterManagement,TrackableComponent,org.springframework.messaging.MessageHandler,reactor.core.CoreSubscriber<org.springframework.messaging.Message<?>>
public class MethodInvokingRouter extends AbstractMappingMessageRouter
A Message Router that invokes the specified method on the given object. The
method's return value may be a single MessageChannel instance, a single
String to be interpreted as a channel name, or a Collection (or Array) of
either type. If the method returns channel names, then a
DestinationResolver is required.-
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, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME -
Constructor Summary
Constructors Constructor Description MethodInvokingRouter(java.lang.Object object)MethodInvokingRouter(java.lang.Object object, java.lang.reflect.Method method)MethodInvokingRouter(java.lang.Object object, java.lang.String methodName) -
Method Summary
Modifier and Type Method Description protected java.util.List<java.lang.Object>getChannelKeys(org.springframework.messaging.Message<?> message)Subclasses must implement this method to return the channel keys.booleanisRunning()voidonInit()Subclasses may implement this for initialization logic.voidstart()voidstop()Methods inherited from class org.springframework.integration.router.AbstractMappingMessageRouter
determineTargetChannels, getChannelMappings, getDynamicChannelNames, removeChannelMapping, replaceChannelMappings, setChannelKeyFallback, setChannelMapping, setChannelMappings, setDynamicChannelLimit, setPrefix, setResolutionRequired, setSuffixMethods inherited from class org.springframework.integration.router.AbstractMessageRouter
getComponentType, getDefaultOutputChannel, getIntegrationPatternType, getMessagingTemplate, getRequiredConversionService, handleMessageInternal, setApplySequence, setDefaultOutputChannel, setDefaultOutputChannelName, setIgnoreSendFailures, setSendTimeoutMethods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribeMethods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
MethodInvokingRouter
public MethodInvokingRouter(java.lang.Object object, java.lang.reflect.Method method) -
MethodInvokingRouter
public MethodInvokingRouter(java.lang.Object object, java.lang.String methodName) -
MethodInvokingRouter
public MethodInvokingRouter(java.lang.Object object)
-
-
Method Details
-
onInit
public final void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
onInitin classAbstractMessageRouter
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle- Specified by:
startin interfaceManageableLifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle- Specified by:
stopin interfaceManageableLifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle- Specified by:
isRunningin interfaceManageableLifecycle
-
getChannelKeys
protected java.util.List<java.lang.Object> getChannelKeys(org.springframework.messaging.Message<?> message)Description copied from class:AbstractMappingMessageRouterSubclasses 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:
getChannelKeysin classAbstractMappingMessageRouter- Parameters:
message- The message.- Returns:
- The channel keys.
-