Class SimpleMessageGroup
java.lang.Object
org.springframework.integration.store.SimpleMessageGroup
- All Implemented Interfaces:
- MessageGroup
- Direct Known Subclasses:
- AbstractCorrelatingMessageHandler.SequenceAwareMessageGroup
Represents a mutable group of correlated messages that is bound to a certain 
MessageStore and group id.
 The group will grow during its lifetime, when messages are add(org.springframework.messaging.Message<?>)ed to it.
 This MessageGroup is thread safe.- Since:
- 2.0
- Author:
- Iwein Fuld, Oleg Zhurakousky, Dave Syer, Gary Russell, Artem Bilan, Christian Tzolov
- 
Constructor SummaryConstructorsConstructorDescriptionSimpleMessageGroup(Object groupId) SimpleMessageGroup(Collection<? extends Message<?>> messages, Object groupId) SimpleMessageGroup(Collection<? extends Message<?>> messages, Object groupId, long timestamp, boolean complete) SimpleMessageGroup(Collection<Message<?>> internalStore, Collection<? extends Message<?>> messages, Object groupId, long timestamp, boolean complete, boolean storePreLoaded) SimpleMessageGroup(MessageGroup messageGroup) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd the message to this group.booleanQuery if the message can be added.voidclear()voidcomplete()Complete the group.booleancontainsSequence(Integer sequence) Return true if a message with this sequence number header exists in the group.Return the condition for this group to consult with, e.g.longintCollection<Message<?>> Return all available Messages from the group at the time of invocation.Message<?> getOne()intlongbooleanbooleanRemove the message from this group.voidsetCondition(String condition) Add a condition statement to this group which can be consulted later on, e.g.voidsetLastModified(long lastModified) voidsetLastReleasedMessageSequenceNumber(int sequenceNumber) intsize()toString()Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.store.MessageGroupstreamMessages
- 
Constructor Details- 
SimpleMessageGroup
- 
SimpleMessageGroup
- 
SimpleMessageGroup
- 
SimpleMessageGrouppublic SimpleMessageGroup(Collection<? extends Message<?>> messages, Object groupId, long timestamp, boolean complete) 
- 
SimpleMessageGrouppublic SimpleMessageGroup(Collection<Message<?>> internalStore, Collection<? extends Message<?>> messages, Object groupId, long timestamp, boolean complete, boolean storePreLoaded) 
 
- 
- 
Method Details- 
getTimestamppublic long getTimestamp()- Specified by:
- getTimestampin interface- MessageGroup
- Returns:
- the timestamp (milliseconds since epoch) associated with the creation of this group
 
- 
setLastModifiedpublic void setLastModified(long lastModified) - Specified by:
- setLastModifiedin interface- MessageGroup
 
- 
getLastModifiedpublic long getLastModified()- Specified by:
- getLastModifiedin interface- MessageGroup
- Returns:
- the timestamp (milliseconds since epoch) associated with the time this group was last updated
 
- 
canAddDescription copied from interface:MessageGroupQuery if the message can be added.- Specified by:
- canAddin interface- MessageGroup
- Parameters:
- message- The message.
- Returns:
- true if the message can be added.
 
- 
addDescription copied from interface:MessageGroupAdd the message to this group.- Specified by:
- addin interface- MessageGroup
- Parameters:
- messageToAdd- the message to add.
 
- 
removeDescription copied from interface:MessageGroupRemove the message from this group.- Specified by:
- removein interface- MessageGroup
- Parameters:
- message- the message to remove.
- Returns:
- trueif a message was removed.
 
- 
getLastReleasedMessageSequenceNumberpublic int getLastReleasedMessageSequenceNumber()- Specified by:
- getLastReleasedMessageSequenceNumberin interface- MessageGroup
- Returns:
- the sequenceNumber of the last released message. Used in Resequencer use cases only
 
- 
getMessagesDescription copied from interface:MessageGroupReturn all available Messages from the group at the time of invocation.- Specified by:
- getMessagesin interface- MessageGroup
- Returns:
- The messages.
 
- 
setLastReleasedMessageSequenceNumberpublic void setLastReleasedMessageSequenceNumber(int sequenceNumber) - Specified by:
- setLastReleasedMessageSequenceNumberin interface- MessageGroup
 
- 
getGroupId- Specified by:
- getGroupIdin interface- MessageGroup
- Returns:
- the key that links these messages together
 
- 
isCompletepublic boolean isComplete()- Specified by:
- isCompletein interface- MessageGroup
- Returns:
- true if the group is complete (i.e. no more messages are expected to be added)
 
- 
completepublic void complete()Description copied from interface:MessageGroupComplete the group.- Specified by:
- completein interface- MessageGroup
 
- 
getSequenceSizepublic int getSequenceSize()- Specified by:
- getSequenceSizein interface- MessageGroup
- Returns:
- the size of the sequence expected 0 if unknown
 
- 
sizepublic int size()- Specified by:
- sizein interface- MessageGroup
- Returns:
- the total number of messages in this group
 
- 
setConditionDescription copied from interface:MessageGroupAdd a condition statement to this group which can be consulted later on, e.g. from the release strategy.- Specified by:
- setConditionin interface- MessageGroup
- Parameters:
- condition- statement which could be consulted later on, e.g. from the release strategy.
 
- 
getConditionDescription copied from interface:MessageGroupReturn the condition for this group to consult with, e.g. from the release strategy.- Specified by:
- getConditionin interface- MessageGroup
- Returns:
- the condition for this group to consult with, e.g. from the release strategy.
 
- 
getOne- Specified by:
- getOnein interface- MessageGroup
- Returns:
- a single message from the group
 
- 
clearpublic void clear()- Specified by:
- clearin interface- MessageGroup
 
- 
containsSequenceReturn true if a message with this sequence number header exists in the group.- Parameters:
- sequence- the sequence number.
- Returns:
- true if it exists.
- Since:
- 4.3.7
 
- 
toString
 
-