public interface MessageGroupStore
Modifier and Type | Interface and Description |
---|---|
static interface |
MessageGroupStore.MessageGroupCallback
Invoked when a MessageGroupStore expires a group.
|
Modifier and Type | Method and Description |
---|---|
MessageGroup |
addMessageToGroup(java.lang.Object groupId,
Message<?> message)
Store a message with an association to a group id.
|
void |
completeGroup(java.lang.Object groupId)
Completes this MessageGroup.
|
int |
expireMessageGroups(long timeout)
Extract all expired groups (whose timestamp is older than the current time less the threshold provided) and call
each of the registered callbacks on them in turn.
|
int |
getMessageCountForAllMessageGroups()
Optional attribute giving the number of messages in the store over all groups.
|
MessageGroup |
getMessageGroup(java.lang.Object groupId)
Return all Messages currently in the MessageStore that were stored using
addMessageToGroup(Object, Message) with this group id. |
int |
getMessageGroupCount()
Optional attribute giving the number of message groups.
|
java.util.Iterator<MessageGroup> |
iterator()
Returns the iterator of currently accumulated
MessageGroup s |
int |
messageGroupSize(java.lang.Object groupId)
Returns the size of this MessageGroup
|
Message<?> |
pollMessageFromGroup(java.lang.Object groupId)
Polls Message from this
MessageGroup (in FIFO style if supported by the implementation)
while also removing the polled Message |
void |
registerMessageGroupExpiryCallback(MessageGroupStore.MessageGroupCallback callback)
Register a callback for when a message group is expired through
expireMessageGroups(long) . |
MessageGroup |
removeMessageFromGroup(java.lang.Object key,
Message<?> messageToRemove)
Persist a deletion on a single message from the group.
|
void |
removeMessageGroup(java.lang.Object groupId)
Remove the message group with this id.
|
void |
setLastReleasedSequenceNumberForGroup(java.lang.Object groupId,
int sequenceNumber)
Allows you to set the sequence number of the last released Message.
|
@ManagedAttribute int getMessageCountForAllMessageGroups()
java.lang.UnsupportedOperationException
- if not implemented@ManagedAttribute int getMessageGroupCount()
java.lang.UnsupportedOperationException
- if not implemented@ManagedAttribute int messageGroupSize(java.lang.Object groupId)
groupId
- MessageGroup getMessageGroup(java.lang.Object groupId)
addMessageToGroup(Object, Message)
with this group id.MessageGroup addMessageToGroup(java.lang.Object groupId, Message<?> message)
groupId
- the group id to store the message undermessage
- a messageMessageGroup removeMessageFromGroup(java.lang.Object key, Message<?> messageToRemove)
key
- the groupId for the group containing the messagemessageToRemove
- the message to be removedvoid removeMessageGroup(java.lang.Object groupId)
groupId
- the id of the group to removevoid registerMessageGroupExpiryCallback(MessageGroupStore.MessageGroupCallback callback)
expireMessageGroups(long)
.callback
- a callback to execute when a message group is cleaned upint expireMessageGroups(long timeout)
timeout
- the timeout threshold to useregisterMessageGroupExpiryCallback(MessageGroupCallback)
void setLastReleasedSequenceNumberForGroup(java.lang.Object groupId, int sequenceNumber)
sequenceNumber
- java.util.Iterator<MessageGroup> iterator()
MessageGroup
sMessage<?> pollMessageFromGroup(java.lang.Object groupId)
MessageGroup
(in FIFO style if supported by the implementation)
while also removing the polled Message
void completeGroup(java.lang.Object groupId)