public abstract class AbstractMessageSplitter extends AbstractReplyProducingMessageHandler implements DiscardingMessageHandler
AbstractReplyProducingMessageHandler.RequestHandlerIntegrationManagement.ManagementOverridesmessagingTemplateEXPRESSION_PARSER, loggerMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
AbstractMessageSplitter() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addHeaders(Message<?> message,
Map<String,Object> headers)
Allows subclasses to add extra headers to the output messages.
|
protected void |
doInit() |
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
MessageChannel |
getDiscardChannel()
Return the discard channel.
|
IntegrationPatternType |
getIntegrationPatternType()
Return a pattern type this component implements.
|
protected Object |
handleRequestMessage(Message<?> message)
Subclasses must implement this method to handle the request Message.
|
protected int |
obtainSizeIfPossible(Iterable<?> iterable)
Obtain a size of the provided
Iterable. |
protected int |
obtainSizeIfPossible(Iterator<?> iterator)
Obtain a size of the provided
Iterator. |
protected void |
produceOutput(Object result,
Message<?> requestMessage) |
void |
setApplySequence(boolean applySequence)
Set the applySequence flag to the specified value.
|
void |
setDiscardChannel(MessageChannel discardChannel)
Specify a channel where rejected Messages should be sent.
|
void |
setDiscardChannelName(String discardChannelName)
Specify a channel bean name (resolved to
MessageChannel lazily)
where rejected Messages should be sent. |
protected boolean |
shouldCopyRequestHeaders()
Subclasses may override this.
|
protected abstract Object |
splitMessage(Message<?> message)
Subclasses must override this method to split the received Message.
|
protected boolean |
willAddHeaders(Message<?> message)
Return true if the subclass needs to add headers in the resulting splits.
|
doInvokeAdvisedRequestHandler, getBeanClassLoader, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReplyaddNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldSplitOutput, updateNotPropagatedHeadershandleMessage, onComplete, onError, onNext, onSubscribebuildSendTimer, configureMetrics, destroy, getActiveCount, getActiveCountLong, getDuration, getErrorCount, getErrorCountLong, getHandleCount, getHandleCountLong, getHandlerMetrics, getManagedName, getManagedType, getMaxDuration, getMeanDuration, getMetricsCaptor, getMinDuration, getOrder, getOverrides, getStandardDeviationDuration, isCountsEnabled, isLoggingEnabled, isStatsEnabled, registerMetricsCaptor, reset, sendTimer, setCountsEnabled, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, setStatsEnabled, shouldTrackafterPropertiesSet, 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, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waithandleMessageerrorCount, handleCountgetBeanName, getComponentNamepublic void setApplySequence(boolean applySequence)
applySequence - true to apply sequence information.public void setDiscardChannel(MessageChannel discardChannel)
discardChannel - The discard channel.public void setDiscardChannelName(String discardChannelName)
MessageChannel lazily)
where rejected Messages should be sent. If the discard
channel is null (the default), rejected Messages will be dropped.
A "Rejected Message" means that split function has returned an empty result (but not null):
no items to iterate for sending.discardChannelName - The discard channel bean name.public MessageChannel getDiscardChannel()
DiscardingMessageHandlergetDiscardChannel in interface DiscardingMessageHandlerpublic IntegrationPatternType getIntegrationPatternType()
IntegrationPatterngetIntegrationPatternType in interface IntegrationPatterngetIntegrationPatternType in class AbstractReplyProducingMessageHandlerIntegrationPatternType this component implements.protected void doInit()
doInit in class AbstractReplyProducingMessageHandlerprotected final Object handleRequestMessage(Message<?> message)
AbstractReplyProducingMessageHandlerhandleRequestMessage in class AbstractReplyProducingMessageHandlermessage - The request message.null.protected int obtainSizeIfPossible(Iterable<?> iterable)
Iterable. Default implementation returns
Collection.size() if the iterable is a collection, or 0 otherwise.
If iterable is a Jackson TreeNode, then its size is used.protected int obtainSizeIfPossible(Iterator<?> iterator)
Iterator.
Default implementation returns 0.protected boolean willAddHeaders(Message<?> message)
addHeaders(org.springframework.messaging.Message<?>, java.util.Map<java.lang.String, java.lang.Object>) will be called.message - the message.protected void addHeaders(Message<?> message, Map<String,Object> headers)
message - the inbound message.headers - the headers to add messages to.protected boolean shouldCopyRequestHeaders()
AbstractMessageProducingHandlershouldCopyRequestHeaders in class AbstractMessageProducingHandlerprotected void produceOutput(Object result, Message<?> requestMessage)
produceOutput in class AbstractMessageProducingHandlerpublic String getComponentType()
IntegrationObjectSupportgetComponentType in interface NamedComponentgetComponentType in class MessageHandlerSupportprotected abstract Object splitMessage(Message<?> message)
message - The message.