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 MongoDbFactory |
mongoDbFactory |
static String |
SEQUENCE_NAME |
| Constructor and Description |
|---|
AbstractConfigurableMongoDbMessageStore(MongoDbFactory mongoDbFactory,
MappingMongoConverter mappingMongoConverter,
String collectionName) |
AbstractConfigurableMongoDbMessageStore(MongoDbFactory 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 int |
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, setTimeoutOnIdlegetRemoveBatchSize, setMessageGroupFactory, setRemoveBatchSizeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMessageGroup, pollMessageFromGroupforEach, spliteratorpublic static final String SEQUENCE_NAME
protected final Log logger
protected final String collectionName
protected final MongoDbFactory mongoDbFactory
public AbstractConfigurableMongoDbMessageStore(MongoTemplate mongoTemplate, String collectionName)
public AbstractConfigurableMongoDbMessageStore(MongoDbFactory mongoDbFactory, String collectionName)
public AbstractConfigurableMongoDbMessageStore(MongoDbFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter, String collectionName)
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext in interface ApplicationContextAwareBeansExceptionprotected MongoTemplate getMongoTemplate()
protected MappingMongoConverter getMappingMongoConverter()
protected ApplicationContext getApplicationContext()
protected MessageBuilderFactory getMessageBuilderFactory()
public void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanpublic MessageMetadata getMessageMetadata(UUID id)
public void removeMessageGroup(Object groupId)
BasicMessageGroupStoreremoveMessageGroup in interface BasicMessageGroupStoregroupId - The id of the group to remove.public int messageGroupSize(Object groupId)
BasicMessageGroupStoremessageGroupSize in interface BasicMessageGroupStoregroupId - The group identifier.protected int 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)
MessageGroupStoreremoveMessagesFromGroup in interface MessageGroupStorekey - The groupId for the group containing the message(s).messages - The messages to be removed.public void setLastReleasedSequenceNumberForGroup(Object groupId, int sequenceNumber)
MessageGroupStoresetLastReleasedSequenceNumberForGroup in interface MessageGroupStoregroupId - The group identifier.sequenceNumber - The sequence number.public Iterator<MessageGroup> iterator()
iterator in interface Iterable<MessageGroup>iterator in interface MessageGroupStoreMessageGroups.public void completeGroup(Object groupId)
MessageGroupStorecompleteGroup in interface MessageGroupStoregroupId - The group identifier.public Message<?> getOneMessageFromGroup(Object groupId)
MessageGroupStoreMessage from MessageGroup.getOneMessageFromGroup in interface MessageGroupStoregroupId - The group identifier.Message.public void addMessagesToGroup(Object groupId, Message<?>... messages)
MessageGroupStoreaddMessagesToGroup in interface MessageGroupStoregroupId - The group id to store messages under.messages - The messages to add.public Collection<Message<?>> getMessagesForGroup(Object groupId)
MessageGroupStoregetMessagesForGroup in interface MessageGroupStoregroupId - The group id to retrieve messages for.