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
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected final Logprotected final MongoDatabaseFactorystatic final StringFields inherited from class org.springframework.integration.store.AbstractMessageGroupStore
GROUP_ID_MUST_NOT_BE_NULL, INTERRUPTED_WHILE_OBTAINING_LOCK -
Constructor Summary
ConstructorsConstructorDescriptionAbstractConfigurableMongoDbMessageStore(MongoTemplate mongoTemplate, String collectionName) AbstractConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory, String collectionName) AbstractConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter, String collectionName) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddMessageDocument(MessageDocument document) voidprotected voidprotected voiddoAddMessagesToGroup(Object groupId, Message<?>... messages) protected voiddoCompleteGroup(Object groupId) protected voiddoRemoveMessageGroup(Object groupId) protected voiddoRemoveMessagesFromGroup(Object key, Collection<Message<?>> messages) protected voiddoSetGroupCondition(Object groupId, String condition) protected voiddoSetLastReleasedSequenceNumberForGroup(Object groupId, int sequenceNumber) protected ApplicationContextprotected MappingMongoConverterMessage<?> getMessage(UUID id) protected MessageBuilderFactoryCollection<Message<?>> getMessagesForGroup(Object groupId) Retrieve messages for the provided group id.protected MongoTemplateprotected longPerform MongoDBINCoperation for the document, which contains theMessageDocumentsequence, and return the new incremented value for the newMessageDocument.Message<?> getOneMessageFromGroup(Object groupId) Return the oneMessagefromMessageGroup.protected static QuerygroupIdQuery(Object groupId) iterator()intmessageGroupSize(Object groupId) Return the size of this MessageGroup.voidsetApplicationContext(ApplicationContext applicationContext) voidsetCreateIndexes(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, setTimeoutOnIdleMethods inherited from class org.springframework.integration.store.AbstractBatchingMessageGroupStore
getRemoveBatchSize, setMessageGroupFactory, setRemoveBatchSizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.store.BasicMessageGroupStore
getMessageGroupMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods 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:
setApplicationContextin interfaceApplicationContextAware- Throws:
BeansException
-
getMongoTemplate
-
getMappingMongoConverter
-
getApplicationContext
-
getMessageBuilderFactory
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceInitializingBean
-
createIndexes
protected void createIndexes() -
getMessage
-
getMessageMetadata
-
doRemoveMessageGroup
- Specified by:
doRemoveMessageGroupin classAbstractMessageGroupStore
-
messageGroupSize
Description copied from interface:BasicMessageGroupStoreReturn the size of this MessageGroup.- Specified by:
messageGroupSizein interfaceBasicMessageGroupStore- Parameters:
groupId- The group identifier.- Returns:
- The size.
-
getNextId
protected long getNextId()Perform MongoDBINCoperation for the document, which contains theMessageDocumentsequence, and return the new incremented value for the newMessageDocument. TheSEQUENCE_NAMEdocument is created on demand.- Returns:
- the next sequence value.
-
addMessageDocument
-
groupIdQuery
-
doRemoveMessagesFromGroup
- Specified by:
doRemoveMessagesFromGroupin classAbstractMessageGroupStore
-
doSetGroupCondition
- Specified by:
doSetGroupConditionin classAbstractMessageGroupStore
-
doSetLastReleasedSequenceNumberForGroup
- Specified by:
doSetLastReleasedSequenceNumberForGroupin classAbstractMessageGroupStore
-
iterator
- Specified by:
iteratorin interfaceIterable<MessageGroup>- Specified by:
iteratorin interfaceMessageGroupStore- Returns:
- The iterator of currently accumulated
MessageGroups.
-
doCompleteGroup
- Specified by:
doCompleteGroupin classAbstractMessageGroupStore
-
getOneMessageFromGroup
Description copied from interface:MessageGroupStoreReturn the oneMessagefromMessageGroup.- Specified by:
getOneMessageFromGroupin interfaceMessageGroupStore- Parameters:
groupId- The group identifier.- Returns:
- the
Message.
-
doAddMessagesToGroup
- Specified by:
doAddMessagesToGroupin classAbstractMessageGroupStore
-
getMessagesForGroup
Description copied from interface:MessageGroupStoreRetrieve messages for the provided group id.- Specified by:
getMessagesForGroupin interfaceMessageGroupStore- Parameters:
groupId- The group id to retrieve messages for.- Returns:
- the messages for group.
-