org.springframework.integration.router
Class MethodInvokingRouter

java.lang.Object
  extended by org.springframework.integration.handler.AbstractMessageHandler
      extended by org.springframework.integration.router.AbstractMessageRouter
          extended by org.springframework.integration.router.MethodInvokingRouter
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, MessageHandler

public class MethodInvokingRouter
extends AbstractMessageRouter
implements org.springframework.beans.factory.InitializingBean

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 ChannelResolver is required.

Author:
Mark Fisher

Field Summary
 
Fields inherited from class org.springframework.integration.handler.AbstractMessageHandler
logger
 
Constructor Summary
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
 void afterPropertiesSet()
           
protected  java.util.Collection<MessageChannel> determineTargetChannels(Message<?> message)
          Subclasses must implement this method to return the target channels for a given Message.
 void setChannelResolver(ChannelResolver channelResolver)
          Provide the ChannelResolver strategy to use for methods that return a channel name rather than a MessageChannel instance.
 
Methods inherited from class org.springframework.integration.router.AbstractMessageRouter
handleMessageInternal, setDefaultOutputChannel, setResolutionRequired, setTimeout
 
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

setChannelResolver

public void setChannelResolver(ChannelResolver channelResolver)
Provide the ChannelResolver strategy to use for methods that return a channel name rather than a MessageChannel instance.


afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

determineTargetChannels

protected final java.util.Collection<MessageChannel> determineTargetChannels(Message<?> message)
Description copied from class: AbstractMessageRouter
Subclasses must implement this method to return the target channels for a given Message.

Specified by:
determineTargetChannels in class AbstractMessageRouter