public class BarrierMessageHandler extends AbstractReplyProducingMessageHandler implements MessageTriggerAction, DiscardingMessageHandler
trigger
method or
the timeout occurs. Only one thread with a particular correlation (result of invoking
the CorrelationStrategy
) can be suspended at a time. If the inbound thread does
not arrive before the trigger thread, the latter is suspended until it does, or the
timeout occurs.
The default CorrelationStrategy
is a HeaderAttributeCorrelationStrategy
.
The default output processor is a DefaultAggregatingMessageGroupProcessor
.
AbstractReplyProducingMessageHandler.RequestHandler
messagingTemplate
EXPRESSION_PARSER, logger
Constructor and Description |
---|
BarrierMessageHandler(long timeout)
Construct an instance with the provided timeout and default correlation and
output strategies.
|
BarrierMessageHandler(long timeout,
CorrelationStrategy correlationStrategy)
Construct an instance with the provided timeout and correlation strategy, and default
output processor.
|
BarrierMessageHandler(long timeout,
MessageGroupProcessor outputProcessor)
Construct an instance with the provided timeout and output processor, and default
correlation strategy.
|
BarrierMessageHandler(long timeout,
MessageGroupProcessor outputProcessor,
CorrelationStrategy correlationStrategy)
Construct an instance with the provided timeout and output processor, and default
correlation strategy.
|
Modifier and Type | Method and Description |
---|---|
protected Object |
buildResult(Object key,
org.springframework.messaging.Message<?> requestMessage,
org.springframework.messaging.Message<?> releaseMessage)
Override to change the default mechanism by which the inbound and release messages
are returned as a result.
|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
org.springframework.messaging.MessageChannel |
getDiscardChannel()
Return the discard channel.
|
protected Object |
handleRequestMessage(org.springframework.messaging.Message<?> requestMessage)
Subclasses must implement this method to handle the request Message.
|
void |
setDiscardChannel(org.springframework.messaging.MessageChannel discardChannel)
Set the channel to which late arriving trigger messages are sent.
|
void |
setDiscardChannelName(String discardChannelName)
Set the name of the channel to which late arriving trigger messages are sent.
|
void |
trigger(org.springframework.messaging.Message<?> message)
Take some action based on the message.
|
doInit, doInvokeAdvisedRequestHandler, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReply
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldCopyRequestHeaders, shouldSplitOutput
configureMetrics, getActiveCount, getActiveCountLong, getDuration, getErrorCount, getErrorCountLong, getHandleCount, getHandleCountLong, getManagedName, getManagedType, getMaxDuration, getMeanDuration, getMinDuration, getOrder, getStandardDeviationDuration, handleMessage, isCountsEnabled, isLoggingEnabled, isStatsEnabled, reset, setCountsEnabled, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, setStatsEnabled
afterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getComponentName
public BarrierMessageHandler(long timeout)
timeout
- the timeout in milliseconds.public BarrierMessageHandler(long timeout, MessageGroupProcessor outputProcessor)
timeout
- the timeout in milliseconds.outputProcessor
- the output MessageGroupProcessor
.public BarrierMessageHandler(long timeout, CorrelationStrategy correlationStrategy)
timeout
- the timeout in milliseconds.correlationStrategy
- the correlation strategy.public BarrierMessageHandler(long timeout, MessageGroupProcessor outputProcessor, CorrelationStrategy correlationStrategy)
timeout
- the timeout in milliseconds.outputProcessor
- the output MessageGroupProcessor
.correlationStrategy
- the correlation strategy.public void setDiscardChannelName(String discardChannelName)
discardChannelName
- the discard channel.public void setDiscardChannel(org.springframework.messaging.MessageChannel discardChannel)
discardChannel
- the discard channel.public org.springframework.messaging.MessageChannel getDiscardChannel()
DiscardingMessageHandler
getDiscardChannel
in interface DiscardingMessageHandler
public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class AbstractMessageHandler
protected Object handleRequestMessage(org.springframework.messaging.Message<?> requestMessage)
AbstractReplyProducingMessageHandler
handleRequestMessage
in class AbstractReplyProducingMessageHandler
requestMessage
- The request message.null
.protected Object buildResult(Object key, org.springframework.messaging.Message<?> requestMessage, org.springframework.messaging.Message<?> releaseMessage)
key
- The correlation key.requestMessage
- the inbound message.releaseMessage
- the release message.public void trigger(org.springframework.messaging.Message<?> message)
MessageTriggerAction
trigger
in interface MessageTriggerAction
message
- the message.