Class AbstractConfigurableMongoDbMessageStore
java.lang.Object
org.springframework.integration.store.AbstractBatchingMessageGroupStore
org.springframework.integration.store.AbstractMessageGroupStore
org.springframework.integration.mongodb.store.AbstractConfigurableMongoDbMessageStore
- All Implemented Interfaces:
Iterable<MessageGroup>
,Aware
,InitializingBean
,ApplicationContextAware
,BasicMessageGroupStore
,MessageGroupStore
- Direct Known Subclasses:
ConfigurableMongoDbMessageStore
,MongoDbChannelMessageStore
public abstract class AbstractConfigurableMongoDbMessageStore
extends AbstractMessageGroupStore
implements InitializingBean, ApplicationContextAware
The abstract MongoDB
AbstractMessageGroupStore
implementation to provide configuration for common options
for implementations of this class.- Since:
- 4.0
- Author:
- Artem Bilan, Adama Sorho, Youbin Wu
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.store.MessageGroupStore
MessageGroupStore.MessageGroupCallback
-
Field Summary
Modifier and TypeFieldDescriptionprotected final String
protected final Log
protected final MongoDatabaseFactory
static final String
Fields inherited from class org.springframework.integration.store.AbstractMessageGroupStore
GROUP_ID_MUST_NOT_BE_NULL, INTERRUPTED_WHILE_OBTAINING_LOCK
-
Constructor Summary
ConstructorDescriptionAbstractConfigurableMongoDbMessageStore
(MongoTemplate mongoTemplate, String collectionName) AbstractConfigurableMongoDbMessageStore
(MongoDatabaseFactory mongoDbFactory, String collectionName) AbstractConfigurableMongoDbMessageStore
(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter, String collectionName) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addMessageDocument
(MessageDocument document) void
protected void
protected void
doAddMessagesToGroup
(Object groupId, Message<?>... messages) protected void
doCompleteGroup
(Object groupId) protected void
doRemoveMessageGroup
(Object groupId) protected void
doRemoveMessagesFromGroup
(Object key, Collection<Message<?>> messages) protected void
doSetGroupCondition
(Object groupId, String condition) protected void
doSetLastReleasedSequenceNumberForGroup
(Object groupId, int sequenceNumber) protected ApplicationContext
protected MappingMongoConverter
Message<?>
getMessage
(UUID id) protected MessageBuilderFactory
Collection<Message<?>>
getMessagesForGroup
(Object groupId) Retrieve messages for the provided group id.protected MongoTemplate
protected long
Perform MongoDBINC
operation for the document, which contains theMessageDocument
sequence
, and return the new incremented value for the newMessageDocument
.Message<?>
getOneMessageFromGroup
(Object groupId) Return the oneMessage
fromMessageGroup
.protected static Query
groupIdQuery
(Object groupId) iterator()
int
messageGroupSize
(Object groupId) Return the size of this MessageGroup.void
setApplicationContext
(ApplicationContext applicationContext) void
setCreateIndexes
(boolean createIndexes) Define the option to auto create indexes or not.Methods inherited from class org.springframework.integration.store.AbstractMessageGroupStore
addMessagesToGroup, addMessageToGroup, completeGroup, copy, doPollMessageFromGroup, doRemoveMessageFromGroupById, executeLocked, executeLocked, expireMessageGroups, getGroupMetadata, getLockRegistry, getMessageCountForAllMessageGroups, getMessageGroupCount, getMessageGroupFactory, isTimeoutOnIdle, pollMessageFromGroup, registerMessageGroupExpiryCallback, removeMessageFromGroupById, removeMessageGroup, removeMessagesFromGroup, removeMessagesFromGroup, setExpiryCallbacks, setGroupCondition, setLastReleasedSequenceNumberForGroup, setLazyLoadMessageGroups, setLockRegistry, setTimeoutOnIdle
Methods inherited from class org.springframework.integration.store.AbstractBatchingMessageGroupStore
getRemoveBatchSize, setMessageGroupFactory, setRemoveBatchSize
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.BasicMessageGroupStore
getMessageGroup
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.springframework.integration.store.MessageGroupStore
getMessageFromGroup, streamMessagesForGroup
-
Field Details
-
SEQUENCE_NAME
- See Also:
-
logger
-
collectionName
-
mongoDbFactory
-
-
Constructor Details
-
AbstractConfigurableMongoDbMessageStore
-
AbstractConfigurableMongoDbMessageStore
public AbstractConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory, String collectionName) -
AbstractConfigurableMongoDbMessageStore
public AbstractConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter, String collectionName)
-
-
Method Details
-
setCreateIndexes
public void setCreateIndexes(boolean createIndexes) Define the option to auto create indexes or not.- Parameters:
createIndexes
- a boolean.- Since:
- 6.0.8.
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Throws:
BeansException
-
getMongoTemplate
-
getMappingMongoConverter
-
getApplicationContext
-
getMessageBuilderFactory
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceInitializingBean
-
createIndexes
protected void createIndexes() -
getMessage
-
getMessageMetadata
-
doRemoveMessageGroup
- Specified by:
doRemoveMessageGroup
in classAbstractMessageGroupStore
-
messageGroupSize
Description copied from interface:BasicMessageGroupStore
Return the size of this MessageGroup.- Specified by:
messageGroupSize
in interfaceBasicMessageGroupStore
- Parameters:
groupId
- The group identifier.- Returns:
- The size.
-
getNextId
protected long getNextId()Perform MongoDBINC
operation for the document, which contains theMessageDocument
sequence
, and return the new incremented value for the newMessageDocument
. TheSEQUENCE_NAME
document is created on demand.- Returns:
- the next sequence value.
-
addMessageDocument
-
groupIdQuery
-
doRemoveMessagesFromGroup
- Specified by:
doRemoveMessagesFromGroup
in classAbstractMessageGroupStore
-
doSetGroupCondition
- Specified by:
doSetGroupCondition
in classAbstractMessageGroupStore
-
doSetLastReleasedSequenceNumberForGroup
- Specified by:
doSetLastReleasedSequenceNumberForGroup
in classAbstractMessageGroupStore
-
iterator
- Specified by:
iterator
in interfaceIterable<MessageGroup>
- Specified by:
iterator
in interfaceMessageGroupStore
- Returns:
- The iterator of currently accumulated
MessageGroup
s.
-
doCompleteGroup
- Specified by:
doCompleteGroup
in classAbstractMessageGroupStore
-
getOneMessageFromGroup
Description copied from interface:MessageGroupStore
Return the oneMessage
fromMessageGroup
.- Specified by:
getOneMessageFromGroup
in interfaceMessageGroupStore
- Parameters:
groupId
- The group identifier.- Returns:
- the
Message
.
-
doAddMessagesToGroup
- Specified by:
doAddMessagesToGroup
in classAbstractMessageGroupStore
-
getMessagesForGroup
Description copied from interface:MessageGroupStore
Retrieve messages for the provided group id.- Specified by:
getMessagesForGroup
in interfaceMessageGroupStore
- Parameters:
groupId
- The group id to retrieve messages for.- Returns:
- the messages for group.
-