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

Nested Class Summary
static class MessagePublishingInterceptor.PayloadType
           
 
Field Summary
private  MessageChannel defaultChannel
           
protected  org.apache.commons.logging.Log logger
           
private  MessageCreator messageCreator
           
private  MessagePublishingInterceptor.PayloadType payloadType
           
 
Constructor Summary
MessagePublishingInterceptor()
           
 
Method Summary
protected  MessagePublishingInterceptor.PayloadType determinePayloadType(org.aopalliance.intercept.MethodInvocation invocation)
           
 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.
private  void sendMessage(java.lang.Object payload, org.aopalliance.intercept.MethodInvocation invocation)
           
 void setDefaultChannel(MessageChannel defaultChannel)
           
 void setMessageCreator(MessageCreator messageCreator)
          Specify the MessageCreator to use when creating a message from the return value Object.
 void setPayloadType(MessagePublishingInterceptor.PayloadType payloadType)
           
 
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

payloadType

private volatile MessagePublishingInterceptor.PayloadType payloadType
Constructor Detail

MessagePublishingInterceptor

public MessagePublishingInterceptor()
Method Detail

setDefaultChannel

public void setDefaultChannel(MessageChannel defaultChannel)

setPayloadType

public void setPayloadType(MessagePublishingInterceptor.PayloadType payloadType)

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

sendMessage

private void sendMessage(java.lang.Object payload,
                         org.aopalliance.intercept.MethodInvocation invocation)

resolveChannel

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


determinePayloadType

protected MessagePublishingInterceptor.PayloadType determinePayloadType(org.aopalliance.intercept.MethodInvocation invocation)