org.springframework.integration.aop
Class MessagePublishingInterceptor

java.lang.Object
  extended by org.springframework.integration.aop.MessagePublishingInterceptor
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor
Direct Known Subclasses:
AnnotationAwareMessagePublishingInterceptor

public class MessagePublishingInterceptor
extends java.lang.Object
implements org.aopalliance.intercept.MethodInterceptor

Interceptor that publishes a target method's return value to a channel.

Author:
Mark Fisher

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
MessagePublishingInterceptor()
           
 
Method Summary
 java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
          Invoke the target method and publish its return value.
protected  MessageChannel resolveChannel(org.aopalliance.intercept.MethodInvocation invocation)
          Subclasses may override this method to provide custom behavior.
 void setDefaultChannel(MessageChannel defaultChannel)
           
 void setMessageMapper(MessageMapper mapper)
          Specify the MessageMapper to use when creating a message from the return value Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected org.apache.commons.logging.Log logger
Constructor Detail

MessagePublishingInterceptor

public MessagePublishingInterceptor()
Method Detail

setDefaultChannel

public void setDefaultChannel(MessageChannel defaultChannel)

setMessageMapper

public void setMessageMapper(MessageMapper mapper)
Specify the MessageMapper to use when creating a message from the return value Object. The default is a SimplePayloadMessageMapper.

Parameters:
mapper - the mapper to use

invoke

public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
                        throws java.lang.Throwable
Invoke the target method and publish its return value.

Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
Throws:
java.lang.Throwable

resolveChannel

protected MessageChannel resolveChannel(org.aopalliance.intercept.MethodInvocation invocation)
Subclasses may override this method to provide custom behavior.