Class MongoDbChannelMessageStore
java.lang.Object
org.springframework.integration.store.AbstractBatchingMessageGroupStore
org.springframework.integration.store.AbstractMessageGroupStore
org.springframework.integration.mongodb.store.AbstractConfigurableMongoDbMessageStore
org.springframework.integration.mongodb.store.MongoDbChannelMessageStore
- All Implemented Interfaces:
- Iterable<MessageGroup>,- Aware,- InitializingBean,- ApplicationContextAware,- BasicMessageGroupStore,- ChannelMessageStore,- MessageGroupStore,- PriorityCapableChannelMessageStore
public class MongoDbChannelMessageStore
extends AbstractConfigurableMongoDbMessageStore
implements PriorityCapableChannelMessageStore
MongoDB 
PriorityCapableChannelMessageStore implementation.
 This message store shall be used for message channels only.
 Provide the priorityEnabled option to allow to poll messages via priority manner.
 
As a priority document field the IntegrationMessageHeaderAccessor.PRIORITY
 message header is used.
 
The same collection can be used for org.springframework.integration.channel.QueueChannels and
 org.springframework.integration.channel.PriorityChannels, but the different instances of
 MongoDbChannelMessageStore should be used for those cases, and the last one with
 priorityEnabled = true option.
- Since:
- 4.0
- Author:
- Artem Bilan, Adama Sorho, Youbin Wu
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.integration.store.MessageGroupStoreMessageGroupStore.MessageGroupCallback
- 
Field SummaryFieldsFields inherited from class org.springframework.integration.mongodb.store.AbstractConfigurableMongoDbMessageStorecollectionName, logger, mongoDbFactory, SEQUENCE_NAMEFields inherited from class org.springframework.integration.store.AbstractMessageGroupStoreINTERRUPTED_WHILE_OBTAINING_LOCK
- 
Constructor SummaryConstructorsConstructorDescriptionMongoDbChannelMessageStore(MongoTemplate mongoTemplate) MongoDbChannelMessageStore(MongoTemplate mongoTemplate, String collectionName) MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory) MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory, String collectionName) MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory, @Nullable MappingMongoConverter mappingMongoConverter, String collectionName) MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter) 
- 
Method SummaryModifier and TypeMethodDescriptionaddMessageToGroup(Object groupId, Message<?> message) Store a message with an association to a group id.protected voidprotected @Nullable Message<?> doPollMessageFromGroup(Object groupId) getMessageGroup(Object groupId) Not fully used.booleanvoidsetPriorityEnabled(boolean priorityEnabled) Methods inherited from class org.springframework.integration.mongodb.store.AbstractConfigurableMongoDbMessageStoreaddMessageDocument, afterPropertiesSet, doAddMessagesToGroup, doCompleteGroup, doRemoveMessageGroup, doRemoveMessagesFromGroup, doSetGroupCondition, doSetLastReleasedSequenceNumberForGroup, getApplicationContext, getMappingMongoConverter, getMessage, getMessageBuilderFactory, getMessageMetadata, getMessagesForGroup, getMongoTemplate, getNextId, groupIdQuery, iterator, messageGroupSize, setApplicationContext, setCreateIndexesMethods inherited from class org.springframework.integration.store.AbstractMessageGroupStoreaddMessagesToGroup, completeGroup, copy, doRemoveMessageFromGroupById, executeLocked, executeLocked, expireMessageGroups, getLockRegistry, getMessageCountForAllMessageGroups, getMessageGroupCount, getMessageGroupFactory, isTimeoutOnIdle, pollMessageFromGroup, registerMessageGroupExpiryCallback, removeMessageFromGroupById, removeMessageGroup, removeMessagesFromGroup, removeMessagesFromGroup, setExpiryCallbacks, setGroupCondition, setLastReleasedSequenceNumberForGroup, setLazyLoadMessageGroups, setLockRegistry, setTimeoutOnIdleMethods inherited from class org.springframework.integration.store.AbstractBatchingMessageGroupStoregetRemoveBatchSize, setMessageGroupFactory, setRemoveBatchSizeMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.store.BasicMessageGroupStoremessageGroupSize, pollMessageFromGroup, removeMessageGroupMethods inherited from interface java.lang.IterableforEach, spliteratorMethods inherited from interface org.springframework.integration.store.MessageGroupStoregetGroupMetadata, getMessageFromGroup, getOneMessageFromGroup, streamMessagesForGroup
- 
Field Details- 
DEFAULT_COLLECTION_NAMEThe default conventional collection name.- See Also:
 
 
- 
- 
Constructor Details- 
MongoDbChannelMessageStore
- 
MongoDbChannelMessageStore
- 
MongoDbChannelMessageStore
- 
MongoDbChannelMessageStorepublic MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter) 
- 
MongoDbChannelMessageStore
- 
MongoDbChannelMessageStorepublic MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory, @Nullable MappingMongoConverter mappingMongoConverter, String collectionName) 
 
- 
- 
Method Details- 
setPriorityEnabledpublic void setPriorityEnabled(boolean priorityEnabled) 
- 
isPriorityEnabledpublic boolean isPriorityEnabled()- Specified by:
- isPriorityEnabledin interface- PriorityCapableChannelMessageStore
- Returns:
- true if message priority is enabled in this channel message store.
 
- 
createIndexesprotected void createIndexes()- Overrides:
- createIndexesin class- AbstractConfigurableMongoDbMessageStore
 
- 
addMessageToGroupDescription copied from interface:BasicMessageGroupStoreStore a message with an association to a group id. This can be used to group messages together.- Specified by:
- addMessageToGroupin interface- BasicMessageGroupStore
- Overrides:
- addMessageToGroupin class- AbstractMessageGroupStore
- Parameters:
- groupId- The group id to store the message under.
- message- A message.
- Returns:
- The message group.
 
- 
getMessageGroupNot fully used. Only wraps the provided group id.- Specified by:
- getMessageGroupin interface- BasicMessageGroupStore
- Parameters:
- groupId- The group identifier.
- Returns:
- A group of messages, empty if none exists for this key.
 
- 
doPollMessageFromGroup- Specified by:
- doPollMessageFromGroupin class- AbstractMessageGroupStore
 
 
-