|
Spring Integration | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.integration.context.IntegrationObjectSupport org.springframework.integration.handler.AbstractMessageHandler org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler
public abstract class AbstractCorrelatingMessageHandler
Abstract Message handler that holds a buffer of correlated messages in a
MessageStore
. This class takes care of correlated groups of messages
that can be completed in batches. It is useful for custom implementation of MessageHandlers that require correlation
and is used as a base class for Aggregator - AggregatingMessageHandler
and
Resequencer - ResequencingMessageHandler
,
or custom implementations requiring correlation.
To customize this handler inject CorrelationStrategy
,
ReleaseStrategy
, and MessageGroupProcessor
implementations as
you require.
By default the CorrelationStrategy
will be a
HeaderAttributeCorrelationStrategy
and the ReleaseStrategy
will be a
SequenceSizeReleaseStrategy
.
Field Summary | |
---|---|
static long |
DEFAULT_SEND_TIMEOUT
|
protected MessageGroupStore |
messageStore
|
Fields inherited from interface org.springframework.core.Ordered |
---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary | |
---|---|
AbstractCorrelatingMessageHandler(MessageGroupProcessor processor)
|
|
AbstractCorrelatingMessageHandler(MessageGroupProcessor processor,
MessageGroupStore store)
|
|
AbstractCorrelatingMessageHandler(MessageGroupProcessor processor,
MessageGroupStore store,
CorrelationStrategy correlationStrategy,
ReleaseStrategy releaseStrategy)
|
Method Summary | |
---|---|
protected abstract void |
afterRelease(MessageGroup group,
java.util.Collection<Message<?>> completedMessages)
Allows you to provide additional logic that needs to be performed after the MessageGroup was released. |
protected int |
findLastReleasedSequenceNumber(java.lang.Object groupId,
java.util.Collection<Message<?>> partialSequence)
|
java.lang.String |
getComponentType()
Subclasses may implement this method to provide component type information. |
protected MessageGroupStore |
getMessageStore()
|
protected void |
handleMessageInternal(Message<?> message)
|
protected void |
onInit()
Subclasses may implement this for initialization logic. |
void |
setCorrelationStrategy(CorrelationStrategy correlationStrategy)
|
void |
setDiscardChannel(MessageChannel discardChannel)
|
void |
setLockRegistry(LockRegistry lockRegistry)
|
void |
setMessageStore(MessageGroupStore store)
|
void |
setMinimumTimeoutForEmptyGroups(long minimumTimeoutForEmptyGroups)
By default, when a MessageGroupStoreReaper is configured to expire partial groups, empty groups are also removed. |
void |
setOutputChannel(MessageChannel outputChannel)
Specify the MessageChannel to which produced Messages should be sent. |
void |
setReleasePartialSequences(boolean releasePartialSequences)
|
void |
setReleaseStrategy(ReleaseStrategy releaseStrategy)
|
void |
setSendPartialResultOnExpiry(boolean sendPartialResultOnExpiry)
|
void |
setSendTimeout(long sendTimeout)
|
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler |
---|
getOrder, handleMessage, setOrder, setShouldTrack |
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
---|
afterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, setApplicationContext, 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 |
Field Detail |
---|
public static final long DEFAULT_SEND_TIMEOUT
protected volatile MessageGroupStore messageStore
Constructor Detail |
---|
public AbstractCorrelatingMessageHandler(MessageGroupProcessor processor, MessageGroupStore store, CorrelationStrategy correlationStrategy, ReleaseStrategy releaseStrategy)
public AbstractCorrelatingMessageHandler(MessageGroupProcessor processor, MessageGroupStore store)
public AbstractCorrelatingMessageHandler(MessageGroupProcessor processor)
Method Detail |
---|
public void setLockRegistry(LockRegistry lockRegistry)
public void setMessageStore(MessageGroupStore store)
public void setCorrelationStrategy(CorrelationStrategy correlationStrategy)
public void setReleaseStrategy(ReleaseStrategy releaseStrategy)
public void setOutputChannel(MessageChannel outputChannel)
MessageProducer
setOutputChannel
in interface MessageProducer
protected void onInit() throws java.lang.Exception
IntegrationObjectSupport
onInit
in class IntegrationObjectSupport
java.lang.Exception
public void setDiscardChannel(MessageChannel discardChannel)
public void setSendTimeout(long sendTimeout)
public void setSendPartialResultOnExpiry(boolean sendPartialResultOnExpiry)
public void setMinimumTimeoutForEmptyGroups(long minimumTimeoutForEmptyGroups)
minimumTimeoutForEmptyGroups
- The minimum timeout.public void setReleasePartialSequences(boolean releasePartialSequences)
public java.lang.String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class AbstractMessageHandler
protected MessageGroupStore getMessageStore()
protected void handleMessageInternal(Message<?> message) throws java.lang.Exception
handleMessageInternal
in class AbstractMessageHandler
java.lang.Exception
protected abstract void afterRelease(MessageGroup group, java.util.Collection<Message<?>> completedMessages)
group
- completedMessages
- protected int findLastReleasedSequenceNumber(java.lang.Object groupId, java.util.Collection<Message<?>> partialSequence)
|
Spring Integration | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |