public abstract class AbstractConfigurableMongoDbMessageStore extends AbstractMessageGroupStore implements InitializingBean, ApplicationContextAware
AbstractMessageGroupStore
implementation to provide configuration for common options
for implementations of this class.MessageGroupStore.MessageGroupCallback
Modifier and Type | Field and Description |
---|---|
protected String |
collectionName |
protected Log |
logger |
protected MongoDatabaseFactory |
mongoDbFactory |
static String |
SEQUENCE_NAME |
Constructor and Description |
---|
AbstractConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory,
MappingMongoConverter mappingMongoConverter,
String collectionName) |
AbstractConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory,
String collectionName) |
AbstractConfigurableMongoDbMessageStore(MongoTemplate mongoTemplate,
String collectionName) |
Modifier and Type | Method and Description |
---|---|
protected void |
addMessageDocument(MessageDocument document) |
void |
addMessagesToGroup(Object groupId,
Message<?>... messages)
Store messages with an association to a group id.
|
void |
afterPropertiesSet() |
void |
completeGroup(Object groupId)
Completes this MessageGroup.
|
protected ApplicationContext |
getApplicationContext() |
protected MappingMongoConverter |
getMappingMongoConverter() |
Message<?> |
getMessage(UUID id) |
protected MessageBuilderFactory |
getMessageBuilderFactory() |
MessageMetadata |
getMessageMetadata(UUID id) |
Collection<Message<?>> |
getMessagesForGroup(Object groupId)
Retrieve messages for the provided group id.
|
protected MongoTemplate |
getMongoTemplate() |
protected long |
getNextId()
Perform MongoDB
INC operation for the document, which contains the MessageDocument
sequence , and return the new incremented value for the new MessageDocument . |
Message<?> |
getOneMessageFromGroup(Object groupId)
Return the one
Message from MessageGroup . |
protected static Query |
groupIdQuery(Object groupId) |
Iterator<MessageGroup> |
iterator() |
int |
messageGroupSize(Object groupId)
Returns the size of this MessageGroup.
|
void |
removeMessageGroup(Object groupId)
Remove the message group with this id.
|
void |
removeMessagesFromGroup(Object key,
Collection<Message<?>> messages)
Persist the deletion of messages from the group.
|
void |
setApplicationContext(ApplicationContext applicationContext) |
void |
setLastReleasedSequenceNumberForGroup(Object groupId,
int sequenceNumber)
Allows you to set the sequence number of the last released Message.
|
addMessageToGroup, copy, expireMessageGroups, getGroupMetadata, getMessageCountForAllMessageGroups, getMessageGroupCount, getMessageGroupFactory, isTimeoutOnIdle, registerMessageGroupExpiryCallback, removeMessagesFromGroup, setExpiryCallbacks, setLazyLoadMessageGroups, setTimeoutOnIdle
getRemoveBatchSize, setMessageGroupFactory, setRemoveBatchSize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMessageGroup, pollMessageFromGroup
forEach, spliterator
public static final String SEQUENCE_NAME
protected final Log logger
protected final String collectionName
protected final MongoDatabaseFactory mongoDbFactory
public AbstractConfigurableMongoDbMessageStore(MongoTemplate mongoTemplate, String collectionName)
public AbstractConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory, String collectionName)
public AbstractConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter, String collectionName)
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
protected MongoTemplate getMongoTemplate()
protected MappingMongoConverter getMappingMongoConverter()
protected ApplicationContext getApplicationContext()
protected MessageBuilderFactory getMessageBuilderFactory()
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
public MessageMetadata getMessageMetadata(UUID id)
public void removeMessageGroup(Object groupId)
BasicMessageGroupStore
removeMessageGroup
in interface BasicMessageGroupStore
groupId
- The id of the group to remove.public int messageGroupSize(Object groupId)
BasicMessageGroupStore
messageGroupSize
in interface BasicMessageGroupStore
groupId
- The group identifier.protected long getNextId()
INC
operation for the document, which contains the MessageDocument
sequence
, and return the new incremented value for the new MessageDocument
.
The SEQUENCE_NAME
document is created on demand.protected void addMessageDocument(MessageDocument document)
public void removeMessagesFromGroup(Object key, Collection<Message<?>> messages)
MessageGroupStore
removeMessagesFromGroup
in interface MessageGroupStore
key
- The groupId for the group containing the message(s).messages
- The messages to be removed.public void setLastReleasedSequenceNumberForGroup(Object groupId, int sequenceNumber)
MessageGroupStore
setLastReleasedSequenceNumberForGroup
in interface MessageGroupStore
groupId
- The group identifier.sequenceNumber
- The sequence number.public Iterator<MessageGroup> iterator()
iterator
in interface Iterable<MessageGroup>
iterator
in interface MessageGroupStore
MessageGroup
s.public void completeGroup(Object groupId)
MessageGroupStore
completeGroup
in interface MessageGroupStore
groupId
- The group identifier.public Message<?> getOneMessageFromGroup(Object groupId)
MessageGroupStore
Message
from MessageGroup
.getOneMessageFromGroup
in interface MessageGroupStore
groupId
- The group identifier.Message
.public void addMessagesToGroup(Object groupId, Message<?>... messages)
MessageGroupStore
addMessagesToGroup
in interface MessageGroupStore
groupId
- The group id to store messages under.messages
- The messages to add.public Collection<Message<?>> getMessagesForGroup(Object groupId)
MessageGroupStore
getMessagesForGroup
in interface MessageGroupStore
groupId
- The group id to retrieve messages for.