Interface MessageGroup
- All Known Implementing Classes:
- AbstractCorrelatingMessageHandler.SequenceAwareMessageGroup,- SimpleMessageGroup
public interface MessageGroup
A group of messages that are correlated with each other and should be processed in the same context.
 
The message group allows implementations to be mutable, but this behavior is optional. Implementations should take care to document their thread safety and mutability.
- Author:
- Dave Syer, Oleg Zhurakousky, Gary Russell, Artem Bilan
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd the message to this group.booleanQuery if the message can be added.voidclear()voidcomplete()Complete 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()Return a stream for messages stored in this group.
- 
Method Details- 
canAddQuery if the message can be added.- Parameters:
- message- The message.
- Returns:
- true if the message can be added.
 
- 
addAdd the message to this group.- Parameters:
- messageToAdd- the message to add.
- Since:
- 4.3
 
- 
removeRemove the message from this group.- Parameters:
- messageToRemove- the message to remove.
- Returns:
- trueif a message was removed.
- Since:
- 4.3
 
- 
getMessagesCollection<Message<?>> getMessages()Return all available Messages from the group at the time of invocation.- Returns:
- The messages.
 
- 
streamMessages
- 
getGroupIdObject getGroupId()- Returns:
- the key that links these messages together
 
- 
getLastReleasedMessageSequenceNumberint getLastReleasedMessageSequenceNumber()- Returns:
- the sequenceNumber of the last released message. Used in Resequencer use cases only
 
- 
setLastReleasedMessageSequenceNumbervoid setLastReleasedMessageSequenceNumber(int sequenceNumber) 
- 
isCompleteboolean isComplete()- Returns:
- true if the group is complete (i.e. no more messages are expected to be added)
 
- 
completevoid complete()Complete the group.
- 
getSequenceSizeint getSequenceSize()- Returns:
- the size of the sequence expected 0 if unknown
 
- 
sizeint size()- Returns:
- the total number of messages in this group
 
- 
getOneMessage<?> getOne()- Returns:
- a single message from the group
 
- 
getTimestamplong getTimestamp()- Returns:
- the timestamp (milliseconds since epoch) associated with the creation of this group
 
- 
getLastModifiedlong getLastModified()- Returns:
- the timestamp (milliseconds since epoch) associated with the time this group was last updated
 
- 
setLastModifiedvoid setLastModified(long lastModified) 
- 
setConditionAdd a condition statement to this group which can be consulted later on, e.g. from the release strategy.- Parameters:
- condition- statement which could be consulted later on, e.g. from the release strategy.
- Since:
- 5.5
 
- 
getCondition
- 
clearvoid clear()
 
-