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
-
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
-
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
addMessagesToGroup
(Object groupId, Message<?>... messages) Store messages with an association to a group id.void
void
completeGroup
(Object groupId) Completes this MessageGroup.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
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
setGroupCondition
(Object groupId, String condition) Add a condition sentence into the group.void
setLastReleasedSequenceNumberForGroup
(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, 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, pollMessageFromGroup
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods 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
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Throws:
BeansException
-
getMongoTemplate
-
getMappingMongoConverter
-
getApplicationContext
-
getMessageBuilderFactory
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceInitializingBean
-
getMessage
-
getMessageMetadata
-
removeMessageGroup
Description copied from interface:BasicMessageGroupStore
Remove the message group with this id.- Specified by:
removeMessageGroup
in interfaceBasicMessageGroupStore
- Parameters:
groupId
- The id of the group to remove.
-
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
-
removeMessagesFromGroup
Description copied from interface:MessageGroupStore
Persist the deletion of messages from the group.- Specified by:
removeMessagesFromGroup
in interfaceMessageGroupStore
- Parameters:
key
- The groupId for the group containing the message(s).messages
- The messages to be removed.
-
setGroupCondition
Description copied from interface:MessageGroupStore
Add 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:
setGroupCondition
in interfaceMessageGroupStore
- Parameters:
groupId
- The group identifier.condition
- The condition to store into the group.
-
setLastReleasedSequenceNumberForGroup
Description copied from interface:MessageGroupStore
Allows you to set the sequence number of the last released Message. Used for Resequencing use cases- Specified by:
setLastReleasedSequenceNumberForGroup
in interfaceMessageGroupStore
- Parameters:
groupId
- The group identifier.sequenceNumber
- The sequence number.
-
iterator
- Specified by:
iterator
in interfaceIterable<MessageGroup>
- Specified by:
iterator
in interfaceMessageGroupStore
- Returns:
- The iterator of currently accumulated
MessageGroup
s.
-
completeGroup
Description copied from interface:MessageGroupStore
Completes 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:
completeGroup
in interfaceMessageGroupStore
- Parameters:
groupId
- The group identifier.
-
getOneMessageFromGroup
Description copied from interface:MessageGroupStore
Return the oneMessage
fromMessageGroup
.- Specified by:
getOneMessageFromGroup
in interfaceMessageGroupStore
- Parameters:
groupId
- The group identifier.- Returns:
- the
Message
.
-
addMessagesToGroup
Description copied from interface:MessageGroupStore
Store messages with an association to a group id. This can be used to group messages together.- Specified by:
addMessagesToGroup
in interfaceMessageGroupStore
- Parameters:
groupId
- The group id to store messages under.messages
- The messages to add.
-
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.
-