@ManagedResource public abstract class AbstractMessageGroupStore extends AbstractBatchingMessageGroupStore implements MessageGroupStore, Iterable<MessageGroup>
MessageGroupStore.MessageGroupCallback
Modifier | Constructor and Description |
---|---|
protected |
AbstractMessageGroupStore() |
protected |
AbstractMessageGroupStore(boolean lazyLoadMessageGroups) |
Modifier and Type | Method and Description |
---|---|
MessageGroup |
addMessageToGroup(Object groupId,
Message<?> message)
Store a message with an association to a group id.
|
protected MessageGroup |
copy(MessageGroup group)
Used by expireMessageGroups.
|
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.
|
MessageGroupMetadata |
getGroupMetadata(Object groupId)
Obtain the group metadata without fetching any messages; must supply all other
group properties; may include the id of the first message.
|
int |
getMessageCountForAllMessageGroups()
Optional attribute giving the number of messages in the store over all groups.
|
int |
getMessageGroupCount()
Optional attribute giving the number of message groups.
|
protected MessageGroupFactory |
getMessageGroupFactory() |
boolean |
isTimeoutOnIdle() |
void |
registerMessageGroupExpiryCallback(MessageGroupStore.MessageGroupCallback callback)
Register a callback for when a message group is expired through
MessageGroupStore.expireMessageGroups(long) . |
void |
removeMessagesFromGroup(Object key,
Message<?>... messages)
Persist the deletion of messages from the group.
|
void |
setExpiryCallbacks(Collection<MessageGroupStore.MessageGroupCallback> expiryCallbacks)
Convenient injection point for expiry callbacks in the message store.
|
void |
setLazyLoadMessageGroups(boolean lazyLoadMessageGroups)
Specify if the result of the
BasicMessageGroupStore.getMessageGroup(Object) should be wrapped
to the PersistentMessageGroup - a lazy-load proxy for messages in group
Defaults to true . |
void |
setTimeoutOnIdle(boolean timeoutOnIdle)
Allows you to override the rule for the timeout calculation.
|
getRemoveBatchSize, setMessageGroupFactory, setRemoveBatchSize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addMessagesToGroup, completeGroup, getMessagesForGroup, getOneMessageFromGroup, iterator, removeMessagesFromGroup, setLastReleasedSequenceNumberForGroup
getMessageGroup, messageGroupSize, pollMessageFromGroup, removeMessageGroup
forEach, iterator, spliterator
protected final Log logger
protected AbstractMessageGroupStore()
protected AbstractMessageGroupStore(boolean lazyLoadMessageGroups)
protected MessageGroupFactory getMessageGroupFactory()
getMessageGroupFactory
in class AbstractBatchingMessageGroupStore
public void setExpiryCallbacks(Collection<MessageGroupStore.MessageGroupCallback> expiryCallbacks)
MessageGroupStore.registerMessageGroupExpiryCallback(MessageGroupCallback)
.expiryCallbacks
- the expiry callbacks to addpublic boolean isTimeoutOnIdle()
public void setTimeoutOnIdle(boolean timeoutOnIdle)
MessageGroup
was created. If you want the timeout to be based on the time
the MessageGroup
was idling (e.g., inactive from the last update) invoke this method with 'true'.
Default is 'false'.timeoutOnIdle
- The boolean.public void setLazyLoadMessageGroups(boolean lazyLoadMessageGroups)
BasicMessageGroupStore.getMessageGroup(Object)
should be wrapped
to the PersistentMessageGroup
- a lazy-load proxy for messages in group
Defaults to true
.
The target logic is based on the SimpleMessageGroupFactory.GroupType.PERSISTENT
.
lazyLoadMessageGroups
- the boolean
flag to use.public void registerMessageGroupExpiryCallback(MessageGroupStore.MessageGroupCallback callback)
MessageGroupStore
MessageGroupStore.expireMessageGroups(long)
.registerMessageGroupExpiryCallback
in interface MessageGroupStore
callback
- A callback to execute when a message group is cleaned up.@ManagedOperation public int expireMessageGroups(long timeout)
MessageGroupStore
expireMessageGroups
in interface MessageGroupStore
timeout
- the timeout threshold to useMessageGroupStore.registerMessageGroupExpiryCallback(MessageGroupCallback)
protected MessageGroup copy(MessageGroup group)
group
- The group.@ManagedAttribute public int getMessageCountForAllMessageGroups()
MessageGroupStore
getMessageCountForAllMessageGroups
in interface MessageGroupStore
@ManagedAttribute public int getMessageGroupCount()
MessageGroupStore
getMessageGroupCount
in interface MessageGroupStore
public MessageGroupMetadata getGroupMetadata(Object groupId)
MessageGroupStore
getGroupMetadata
in interface MessageGroupStore
groupId
- The group id.public void removeMessagesFromGroup(Object key, Message<?>... messages)
MessageGroupStore
removeMessagesFromGroup
in interface MessageGroupStore
key
- The groupId for the group containing the message(s).messages
- The messages to be removed.public MessageGroup addMessageToGroup(Object groupId, Message<?> message)
BasicMessageGroupStore
addMessageToGroup
in interface BasicMessageGroupStore
groupId
- The group id to store the message under.message
- A message.