Class 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.
  • 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: IntegrationObjectSupport
      Subclasses may implement this for initialization logic.
      Overrides:
      onInit in class AbstractMessageRouter
    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
      Specified by:
      start in interface ManageableLifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
      Specified by:
      stop in interface ManageableLifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
      Specified by:
      isRunning in interface ManageableLifecycle
    • getChannelKeys

      protected java.util.List<java.lang.Object> getChannelKeys​(org.springframework.messaging.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
      Parameters:
      message - The message.
      Returns:
      The channel keys.