public class ContentEnricher extends AbstractReplyProducingMessageHandler implements ManageableLifecycle
AbstractReplyProducingMessageHandler.RequestHandler
IntegrationManagement.ManagementOverrides
messagingTemplate
EXPRESSION_PARSER, logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
ContentEnricher() |
Modifier and Type | Method and Description |
---|---|
protected void |
doInit()
Initializes the Content Enricher.
|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
IntegrationPatternType |
getIntegrationPatternType()
Return a pattern type this component implements.
|
protected Object |
handleRequestMessage(Message<?> requestMessage)
Subclasses must implement this method to handle the request Message.
|
boolean |
isRunning()
Lifecycle implementation.
|
void |
setErrorChannel(MessageChannel errorChannel)
Set the content enricher's error channel to allow the error handling flow to return
of an alternative object to use for enrichment if exceptions occur in the
downstream flow.
|
void |
setErrorChannelName(String errorChannelName) |
void |
setHeaderExpressions(Map<String,HeaderValueMessageProcessor<?>> headerExpressions)
Provide the map of
HeaderValueMessageProcessor to evaluate when enriching
the target MessageHeaders. |
void |
setIntegrationEvaluationContext(EvaluationContext evaluationContext) |
void |
setNullResultHeaderExpressions(Map<String,HeaderValueMessageProcessor<?>> nullResultHeaderExpressions) |
void |
setNullResultPropertyExpressions(Map<String,Expression> nullResultPropertyExpressions) |
void |
setPropertyExpressions(Map<String,Expression> propertyExpressions)
Provide the map of expressions to evaluate when enriching the target payload.
|
void |
setReplyChannel(MessageChannel replyChannel)
Sets the content enricher's reply channel.
|
void |
setReplyChannelName(String replyChannelName) |
void |
setReplyTimeout(Long replyTimeout)
Set the timeout value for receiving reply messages.
|
void |
setRequestChannel(MessageChannel requestChannel)
Sets the content enricher's request channel.
|
void |
setRequestChannelName(String requestChannelName) |
void |
setRequestPayloadExpression(Expression requestPayloadExpression)
By default the original message's payload will be used as the actual payload that
will be send to the request-channel.
|
void |
setRequestTimeout(Long requestTimeout)
Set the timeout value for sending request messages.
|
void |
setShouldClonePayload(boolean shouldClonePayload)
Specify whether to clone payload objects to create the target object.
|
void |
start()
Lifecycle implementation.
|
void |
stop()
Lifecycle implementation.
|
doInvokeAdvisedRequestHandler, getBeanClassLoader, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReply
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeaders
handleMessage, onComplete, onError, onNext, onSubscribe
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getThisAs
getBeanName, getComponentName
public void setNullResultPropertyExpressions(Map<String,Expression> nullResultPropertyExpressions)
public void setNullResultHeaderExpressions(Map<String,HeaderValueMessageProcessor<?>> nullResultHeaderExpressions)
public void setPropertyExpressions(Map<String,Expression> propertyExpressions)
propertyExpressions
- The property expressions.public void setHeaderExpressions(Map<String,HeaderValueMessageProcessor<?>> headerExpressions)
HeaderValueMessageProcessor
to evaluate when enriching
the target MessageHeaders. The keys should simply be header names, and the values
should be Expressions that will evaluate against the reply Message as the root
object.headerExpressions
- The header expressions.public void setRequestChannel(MessageChannel requestChannel)
requestChannel
- The request channel.public void setRequestChannelName(String requestChannelName)
public void setReplyChannel(MessageChannel replyChannel)
replyChannel
- The reply channel.public void setReplyChannelName(String replyChannelName)
public void setErrorChannel(MessageChannel errorChannel)
errorChannel
- The error channel.public void setErrorChannelName(String errorChannelName)
public void setRequestTimeout(Long requestTimeout)
requestTimeout
- the timeout value in milliseconds. Must not be null.public void setReplyTimeout(Long replyTimeout)
replyTimeout
- the timeout value in milliseconds. Must not be null.public void setRequestPayloadExpression(Expression requestPayloadExpression)
By providing a SpEL expression as value for this setter, a subset of the original payload, a header value or any other resolvable SpEL expression can be used as the basis for the payload, that will be send to the request-channel.
For the Expression evaluation the full message is available as the root object.
For instance the following SpEL expressions (among others) are possible:
If more sophisticated logic is required (e.g. changing the message headers etc.) please use additional downstream transformers.
requestPayloadExpression
- The request payload expression.public void setShouldClonePayload(boolean shouldClonePayload)
shouldClonePayload
- true if the payload should be cloned.public void setIntegrationEvaluationContext(EvaluationContext evaluationContext)
public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class MessageHandlerSupport
public IntegrationPatternType getIntegrationPatternType()
IntegrationPattern
getIntegrationPatternType
in interface IntegrationPattern
getIntegrationPatternType
in class AbstractReplyProducingMessageHandler
IntegrationPatternType
this component implements.protected void doInit()
doInit
in class AbstractReplyProducingMessageHandler
protected Object handleRequestMessage(Message<?> requestMessage)
AbstractReplyProducingMessageHandler
handleRequestMessage
in class AbstractReplyProducingMessageHandler
requestMessage
- The request message.null
.public void start()
start
in interface Lifecycle
start
in interface ManageableLifecycle
public void stop()
stop
in interface Lifecycle
stop
in interface ManageableLifecycle
public boolean isRunning()
isRunning
in interface Lifecycle
isRunning
in interface ManageableLifecycle