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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.store.MessageGroupStore
MessageGroupStore.MessageGroupCallback -
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_COLLECTION_NAMEThe default conventional collection name.Fields inherited from class org.springframework.integration.mongodb.store.AbstractConfigurableMongoDbMessageStore
collectionName, logger, mongoDbFactory, SEQUENCE_NAME -
Constructor Summary
Constructors Constructor Description MongoDbChannelMessageStore(MongoTemplate mongoTemplate)MongoDbChannelMessageStore(MongoTemplate mongoTemplate, String collectionName)MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory)MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory, String collectionName)MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter)MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter, String collectionName) -
Method Summary
Modifier and Type Method Description MessageGroupaddMessageToGroup(Object groupId, Message<?> message)Store a message with an association to a group id.voidafterPropertiesSet()MessageGroupgetMessageGroup(Object groupId)Not fully used.booleanisPriorityEnabled()Message<?>pollMessageFromGroup(Object groupId)Poll Message from thisMessageGroup(in FIFO style if supported by the implementation) while also removing the polledMessage.voidsetPriorityEnabled(boolean priorityEnabled)Methods inherited from class org.springframework.integration.mongodb.store.AbstractConfigurableMongoDbMessageStore
addMessageDocument, addMessagesToGroup, completeGroup, getApplicationContext, getMappingMongoConverter, getMessage, getMessageBuilderFactory, getMessageMetadata, getMessagesForGroup, getMongoTemplate, getNextId, getOneMessageFromGroup, groupIdQuery, iterator, messageGroupSize, removeMessageGroup, removeMessagesFromGroup, setApplicationContext, setGroupCondition, setLastReleasedSequenceNumberForGroupMethods inherited from class org.springframework.integration.store.AbstractMessageGroupStore
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
messageGroupSize, removeMessageGroupMethods inherited from interface org.springframework.integration.store.MessageGroupStore
streamMessagesForGroup
-
Field Details
-
DEFAULT_COLLECTION_NAME
The default conventional collection name.- See Also:
- Constant Field Values
-
-
Constructor Details
-
MongoDbChannelMessageStore
-
MongoDbChannelMessageStore
-
MongoDbChannelMessageStore
-
MongoDbChannelMessageStore
public MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter) -
MongoDbChannelMessageStore
-
MongoDbChannelMessageStore
public MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter, String collectionName)
-
-
Method Details
-
setPriorityEnabled
public void setPriorityEnabled(boolean priorityEnabled) -
isPriorityEnabled
public boolean isPriorityEnabled()- Specified by:
isPriorityEnabledin interfacePriorityCapableChannelMessageStore- Returns:
- true if message priority is enabled in this channel message store.
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceInitializingBean- Overrides:
afterPropertiesSetin classAbstractConfigurableMongoDbMessageStore
-
addMessageToGroup
Description copied from interface:BasicMessageGroupStoreStore a message with an association to a group id. This can be used to group messages together.- Specified by:
addMessageToGroupin interfaceBasicMessageGroupStore- Overrides:
addMessageToGroupin classAbstractMessageGroupStore- Parameters:
groupId- The group id to store the message under.message- A message.- Returns:
- The message group.
-
getMessageGroup
Not fully used. Only wraps the provided group id.- Specified by:
getMessageGroupin interfaceBasicMessageGroupStore- Parameters:
groupId- The group identifier.- Returns:
- A group of messages, empty if none exists for this key.
-
pollMessageFromGroup
Description copied from interface:BasicMessageGroupStorePoll Message from thisMessageGroup(in FIFO style if supported by the implementation) while also removing the polledMessage.- Specified by:
pollMessageFromGroupin interfaceBasicMessageGroupStore- Parameters:
groupId- The group identifier.- Returns:
- The message.
-