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
-
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 String -
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) voidaddMessagesToGroup(Object groupId, Message<?>... messages) Store messages with an association to a group id.voidvoidcompleteGroup(Object groupId) Completes this MessageGroup.protected voidprotected 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.voidremoveMessageGroup(Object groupId) Remove the message group with this id.voidremoveMessagesFromGroup(Object key, Collection<Message<?>> messages) Persist the deletion of messages from the group.voidsetApplicationContext(ApplicationContext applicationContext) voidsetCreateIndexes(boolean createIndexes) Define the option to auto create indexes or not.voidsetGroupCondition(Object groupId, String condition) Add a condition sentence into the group.voidsetLastReleasedSequenceNumberForGroup(Object groupId, int sequenceNumber) Allows you to set the sequence number of the last released Message.Methods inherited from class org.springframework.integration.store.AbstractMessageGroupStore
addMessageToGroup, copy, expireMessageGroups, getGroupMetadata, getMessageCountForAllMessageGroups, getMessageGroupCount, getMessageGroupFactory, isTimeoutOnIdle, registerMessageGroupExpiryCallback, removeMessagesFromGroup, setExpiryCallbacks, setLazyLoadMessageGroups, 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
getMessageGroup, pollMessageFromGroupMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.springframework.integration.store.MessageGroupStore
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
-
removeMessageGroup
Description copied from interface:BasicMessageGroupStoreRemove the message group with this id.- Specified by:
removeMessageGroupin interfaceBasicMessageGroupStore- Parameters:
groupId- The id of the group to remove.
-
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
-
removeMessagesFromGroup
Description copied from interface:MessageGroupStorePersist the deletion of messages from the group.- Specified by:
removeMessagesFromGroupin interfaceMessageGroupStore- Parameters:
key- The groupId for the group containing the message(s).messages- The messages to be removed.
-
setGroupCondition
Description copied from interface:MessageGroupStoreAdd a condition sentence into the group. Can be used later on for making some decisions for group, e.g. release strategy for correlation handler can consult this condition instead of iterating all the messages in group.- Specified by:
setGroupConditionin interfaceMessageGroupStore- Parameters:
groupId- The group identifier.condition- The condition to store into the group.
-
setLastReleasedSequenceNumberForGroup
Description copied from interface:MessageGroupStoreAllows you to set the sequence number of the last released Message. Used for Resequencing use cases- Specified by:
setLastReleasedSequenceNumberForGroupin interfaceMessageGroupStore- Parameters:
groupId- The group identifier.sequenceNumber- The sequence number.
-
iterator
- Specified by:
iteratorin interfaceIterable<MessageGroup>- Specified by:
iteratorin interfaceMessageGroupStore- Returns:
- The iterator of currently accumulated
MessageGroups.
-
completeGroup
Description copied from interface:MessageGroupStoreCompletes this MessageGroup. Completion of the MessageGroup generally means that this group should not be allowing any more mutating operation to be performed on it. For example any attempt to add/remove new Message form the group should not be allowed.- Specified by:
completeGroupin interfaceMessageGroupStore- Parameters:
groupId- The group identifier.
-
getOneMessageFromGroup
Description copied from interface:MessageGroupStoreReturn the oneMessagefromMessageGroup.- Specified by:
getOneMessageFromGroupin interfaceMessageGroupStore- Parameters:
groupId- The group identifier.- Returns:
- the
Message.
-
addMessagesToGroup
Description copied from interface:MessageGroupStoreStore messages with an association to a group id. This can be used to group messages together.- Specified by:
addMessagesToGroupin interfaceMessageGroupStore- Parameters:
groupId- The group id to store messages under.messages- The messages to add.
-
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.
-