org.springframework.integration.transformer
Class ContentEnricher

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.handler.AbstractMessageHandler
          extended by org.springframework.integration.handler.AbstractReplyProducingMessageHandler
              extended by org.springframework.integration.transformer.ContentEnricher
All Implemented Interfaces:
BeanFactoryAware, BeanNameAware, InitializingBean, Lifecycle, Ordered, NamedComponent, Orderable, MessageHandler, MessageProducer, TrackableComponent

public class ContentEnricher
extends AbstractReplyProducingMessageHandler
implements Lifecycle

Content Enricher is a Message Transformer that invokes any downstream message flow via its request channel and then applies values from the reply Message to the original payload.

Since:
2.1

Field Summary
 
Fields inherited from class org.springframework.integration.handler.AbstractMessageHandler
logger
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
ContentEnricher(MessageChannel requestChannel)
          Create a Content Enricher with the given request channel.
ContentEnricher(MessageChannel requestChannel, MessageChannel replyChannel)
          Create a Content Enricher with the given request and reply channels.
 
Method Summary
protected  java.lang.Object handleRequestMessage(Message<?> requestMessage)
          Subclasses must implement this method to handle the request Message.
 boolean isRunning()
           
 void onInit()
          Subclasses may implement this for initialization logic.
 void setPropertyExpressions(java.util.Map<java.lang.String,Expression> propertyExpressions)
          Provide the map of expressions to evaluate when enriching the target payload.
 void setShouldClonePayload(boolean shouldClonePayload)
          Specify whether to clone payload objects to create the target object.
 void start()
           
 void stop()
           
 
Methods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
getMessagingTemplate, handleMessageInternal, setChannelResolver, setOutputChannel, setRequiresReply, setSendTimeout, shouldCopyRequestHeaders
 
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
getComponentType, getOrder, handleMessage, setOrder, setShouldTrack
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.integration.context.NamedComponent
getComponentName
 

Constructor Detail

ContentEnricher

public ContentEnricher(MessageChannel requestChannel)
Create a Content Enricher with the given request channel. An anonymous reply channel will be created for each request.


ContentEnricher

public ContentEnricher(MessageChannel requestChannel,
                       MessageChannel replyChannel)
Create a Content Enricher with the given request and reply channels.

Method Detail

setPropertyExpressions

public void setPropertyExpressions(java.util.Map<java.lang.String,Expression> propertyExpressions)
Provide the map of expressions to evaluate when enriching the target payload. The keys should simply be property names, and the values should be Expressions that will evaluate against the reply Message as the root object.


setShouldClonePayload

public void setShouldClonePayload(boolean shouldClonePayload)
Specify whether to clone payload objects to create the target object. This is only applicable for payload types that implement Cloneable.


onInit

public void onInit()
Description copied from class: IntegrationObjectSupport
Subclasses may implement this for initialization logic.

Overrides:
onInit in class AbstractReplyProducingMessageHandler

handleRequestMessage

protected java.lang.Object handleRequestMessage(Message<?> requestMessage)
Description copied from class: AbstractReplyProducingMessageHandler
Subclasses must implement this method to handle the request Message. The return value may be a Message, a MessageBuilder, or any plain Object. The base class will handle the final creation of a reply Message from any of those starting points. If the return value is null, the Message flow will end here.

Specified by:
handleRequestMessage in class AbstractReplyProducingMessageHandler

start

public void start()
Specified by:
start in interface Lifecycle

stop

public void stop()
Specified by:
stop in interface Lifecycle

isRunning

public boolean isRunning()
Specified by:
isRunning in interface Lifecycle