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
private  MessageChannel defaultChannel
           
protected  org.apache.commons.logging.Log logger
           
private  MessageCreator messageCreator
           
 
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 setMessageCreator(MessageCreator messageCreator)
          Specify the MessageCreator 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 final org.apache.commons.logging.Log logger

messageCreator

private volatile MessageCreator messageCreator

defaultChannel

private volatile MessageChannel defaultChannel
Constructor Detail

MessagePublishingInterceptor

public MessagePublishingInterceptor()
Method Detail

setDefaultChannel

public void setDefaultChannel(MessageChannel defaultChannel)

setMessageCreator

public void setMessageCreator(MessageCreator messageCreator)
Specify the MessageCreator to use when creating a message from the return value Object.

Parameters:
messageCreator - the MessageCreator 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.