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.QueueChannel
s and
org.springframework.integration.channel.PriorityChannel
s, 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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.store.MessageGroupStore
MessageGroupStore.MessageGroupCallback
-
Field Summary
Fields inherited from class org.springframework.integration.mongodb.store.AbstractConfigurableMongoDbMessageStore
collectionName, logger, mongoDbFactory, SEQUENCE_NAME
-
Constructor Summary
ConstructorDescriptionMongoDbChannelMessageStore
(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 TypeMethodDescriptionaddMessageToGroup
(Object groupId, Message<?> message) Store a message with an association to a group id.protected void
getMessageGroup
(Object groupId) Not fully used.boolean
Message<?>
pollMessageFromGroup
(Object groupId) Poll Message from thisMessageGroup
(in FIFO style if supported by the implementation) while also removing the polledMessage
.void
setPriorityEnabled
(boolean priorityEnabled) Methods inherited from class org.springframework.integration.mongodb.store.AbstractConfigurableMongoDbMessageStore
addMessageDocument, addMessagesToGroup, afterPropertiesSet, completeGroup, getApplicationContext, getMappingMongoConverter, getMessage, getMessageBuilderFactory, getMessageMetadata, getMessagesForGroup, getMongoTemplate, getNextId, getOneMessageFromGroup, groupIdQuery, iterator, messageGroupSize, removeMessageGroup, removeMessagesFromGroup, setApplicationContext, setCreateIndexes, setGroupCondition, setLastReleasedSequenceNumberForGroup
Methods inherited from class org.springframework.integration.store.AbstractMessageGroupStore
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
messageGroupSize, removeMessageGroup
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.springframework.integration.store.MessageGroupStore
getMessageFromGroup, removeMessageFromGroupById, streamMessagesForGroup
-
Field Details
-
DEFAULT_COLLECTION_NAME
The default conventional collection name.- See Also:
-
-
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:
isPriorityEnabled
in interfacePriorityCapableChannelMessageStore
- Returns:
- true if message priority is enabled in this channel message store.
-
createIndexes
protected void createIndexes()- Overrides:
createIndexes
in classAbstractConfigurableMongoDbMessageStore
-
addMessageToGroup
Description copied from interface:BasicMessageGroupStore
Store a message with an association to a group id. This can be used to group messages together.- Specified by:
addMessageToGroup
in interfaceBasicMessageGroupStore
- Overrides:
addMessageToGroup
in 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:
getMessageGroup
in interfaceBasicMessageGroupStore
- Parameters:
groupId
- The group identifier.- Returns:
- A group of messages, empty if none exists for this key.
-
pollMessageFromGroup
Description copied from interface:BasicMessageGroupStore
Poll Message from thisMessageGroup
(in FIFO style if supported by the implementation) while also removing the polledMessage
.- Specified by:
pollMessageFromGroup
in interfaceBasicMessageGroupStore
- Parameters:
groupId
- The group identifier.- Returns:
- The message.
-