public abstract class AbstractConfigurableMongoDbMessageStore extends AbstractMessageGroupStore implements BasicMessageGroupStore, InitializingBean, ApplicationContextAware
BasicMessageGroupStore
implementation to provide configuration for common options
for implementations of this class.MessageGroupStore.MessageGroupCallback
Modifier and Type | Field and Description |
---|---|
protected ApplicationContext |
applicationContext |
protected String |
collectionName |
static String |
CREATED_DATE_KEY
The name of the message header that stores a timestamp for the time the message was inserted.
|
protected Log |
logger |
protected MappingMongoConverter |
mappingMongoConverter |
protected MessageBuilderFactory |
messageBuilderFactory |
protected MongoDbFactory |
mongoDbFactory |
protected MongoTemplate |
mongoTemplate |
static String |
SAVED_KEY
The name of the message header that stores a flag to indicate that the message has been saved.
|
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.
|
Message<?> |
getMessage(UUID id) |
Collection<Message<?>> |
getMessagesForGroup(Object groupId)
Retrieve messages for the provided group id.
|
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.
|
MessageGroup |
removeMessageFromGroup(Object key,
Message<?> messageToRemove)
Deprecated.
|
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, getMessageBuilderFactory, getMessageCountForAllMessageGroups, getMessageGroupCount, getMessageGroupFactory, isTimeoutOnIdle, registerMessageGroupExpiryCallback, removeMessagesFromGroup, setBeanFactory, setExpiryCallbacks, setLazyLoadMessageGroups, setTimeoutOnIdle
getRemoveBatchSize, setMessageGroupFactory, setRemoveBatchSize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addMessageToGroup, getMessageGroup, pollMessageFromGroup
forEach, spliterator
public static final String SEQUENCE_NAME
public static final String SAVED_KEY
public static final String CREATED_DATE_KEY
protected final Log logger
protected final String collectionName
protected final MongoDbFactory mongoDbFactory
protected MongoTemplate mongoTemplate
protected MappingMongoConverter mappingMongoConverter
protected ApplicationContext applicationContext
protected MessageBuilderFactory messageBuilderFactory
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 ApplicationContextAware
BeansException
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
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 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)
@Deprecated public MessageGroup removeMessageFromGroup(Object key, Message<?> messageToRemove)
MessageGroupStore
removeMessageFromGroup
in interface MessageGroupStore
key
- The groupId for the group containing the message.messageToRemove
- The message to be removed.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.