org.springframework.integration.store
Class AbstractMessageGroupStore
java.lang.Object
org.springframework.integration.store.AbstractMessageGroupStore
- All Implemented Interfaces:
- java.lang.Iterable<MessageGroup>, MessageGroupStore
- Direct Known Subclasses:
- AbstractKeyValueMessageStore, JdbcChannelMessageStore, JdbcMessageStore, MongoDbMessageStore, SimpleMessageStore
public abstract class AbstractMessageGroupStore
- extends java.lang.Object
- implements MessageGroupStore, java.lang.Iterable<MessageGroup>
- Since:
- 2.0
- Author:
- Dave Syer, Oleg Zhurakousky
Field Summary |
protected org.apache.commons.logging.Log |
logger
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.lang.Iterable |
iterator |
logger
protected final org.apache.commons.logging.Log logger
AbstractMessageGroupStore
public AbstractMessageGroupStore()
setExpiryCallbacks
public void setExpiryCallbacks(java.util.Collection<MessageGroupStore.MessageGroupCallback> expiryCallbacks)
- Convenient injection point for expiry callbacks in the message store. Each of the callbacks provided will simply
be registered with the store using
MessageGroupStore.registerMessageGroupExpiryCallback(MessageGroupCallback)
.
- Parameters:
expiryCallbacks
- the expiry callbacks to add
isTimeoutOnIdle
public boolean isTimeoutOnIdle()
setTimeoutOnIdle
public void setTimeoutOnIdle(boolean timeoutOnIdle)
- Allows you to override the rule for the timeout calculation. Typical timeout is based from the time
the
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'.
registerMessageGroupExpiryCallback
public void registerMessageGroupExpiryCallback(MessageGroupStore.MessageGroupCallback callback)
- Description copied from interface:
MessageGroupStore
- Register a callback for when a message group is expired through
MessageGroupStore.expireMessageGroups(long)
.
- Specified by:
registerMessageGroupExpiryCallback
in interface MessageGroupStore
- Parameters:
callback
- a callback to execute when a message group is cleaned up
expireMessageGroups
public int expireMessageGroups(long timeout)
- Description copied from interface:
MessageGroupStore
- 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. For example: call with a timeout of 100 to expire all groups
that were created more than 100 milliseconds ago, and are not yet complete. Use a timeout of 0 (or negative to be
on the safe side) to expire all message groups.
- Specified by:
expireMessageGroups
in interface MessageGroupStore
- Parameters:
timeout
- the timeout threshold to use
- Returns:
- the number of message groups expired
- See Also:
MessageGroupStore.registerMessageGroupExpiryCallback(MessageGroupCallback)
getMessageCountForAllMessageGroups
@ManagedAttribute
public int getMessageCountForAllMessageGroups()
- Description copied from interface:
MessageGroupStore
- Optional attribute giving the number of messages in the store over all groups. Implementations may decline to
respond by throwing an exception.
- Specified by:
getMessageCountForAllMessageGroups
in interface MessageGroupStore
- Returns:
- the number of messages
getMessageGroupCount
@ManagedAttribute
public int getMessageGroupCount()
- Description copied from interface:
MessageGroupStore
- Optional attribute giving the number of message groups. Implementations may decline
to respond by throwing an exception.
- Specified by:
getMessageGroupCount
in interface MessageGroupStore
- Returns:
- the number message groups