org.springframework.integration.store
Class AbstractMessageGroupStore

java.lang.Object
  extended by org.springframework.integration.store.AbstractMessageGroupStore
All Implemented Interfaces:
java.lang.Iterable<MessageGroup>, MessageGroupStore
Direct Known Subclasses:
JdbcMessageStore, KeyValueMessageGroupStore, MongoDbMessageStore, RedisMessageStore, SimpleMessageStore

public abstract class AbstractMessageGroupStore
extends java.lang.Object
implements MessageGroupStore, java.lang.Iterable<MessageGroup>

Since:
2.0

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
AbstractMessageGroupStore()
           
 
Method Summary
 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 getMarkedMessageCountForAllMessageGroups()
          Optional attribute giving the number of marked messages in the store for all groups.
 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.
abstract  java.util.Iterator<MessageGroup> iterator()
           
 void registerMessageGroupExpiryCallback(MessageGroupCallback callback)
          Register a callback for when a message group is expired through MessageGroupStore.expireMessageGroups(long).
 void setExpiryCallbacks(java.util.Collection<MessageGroupCallback> expiryCallbacks)
          Convenient injection point for expiry callbacks in the message store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.integration.store.MessageGroupStore
addMessageToGroup, getMessageGroup, markMessageFromGroup, markMessageGroup, removeMessageFromGroup, removeMessageGroup
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

AbstractMessageGroupStore

public AbstractMessageGroupStore()
Method Detail

setExpiryCallbacks

public void setExpiryCallbacks(java.util.Collection<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 registerMessageGroupExpiryCallback(MessageGroupCallback).

Parameters:
expiryCallbacks - the expiry callbacks to add

registerMessageGroupExpiryCallback

public void registerMessageGroupExpiryCallback(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)

iterator

public abstract java.util.Iterator<MessageGroup> iterator()
Specified by:
iterator in interface java.lang.Iterable<MessageGroup>

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

getMarkedMessageCountForAllMessageGroups

@ManagedAttribute
public int getMarkedMessageCountForAllMessageGroups()
Description copied from interface: MessageGroupStore
Optional attribute giving the number of marked messages in the store for all groups. Implementations may decline to respond by throwing an exception.

Specified by:
getMarkedMessageCountForAllMessageGroups in interface MessageGroupStore
Returns:
the number of marked messages in each group

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