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, Youbin Wu
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.store.MessageGroupStore
MessageGroupStore.MessageGroupCallback
-
Field Summary
FieldsFields inherited from class org.springframework.integration.mongodb.store.AbstractConfigurableMongoDbMessageStore
collectionName, logger, mongoDbFactory, SEQUENCE_NAME
Fields inherited from class org.springframework.integration.store.AbstractMessageGroupStore
GROUP_ID_MUST_NOT_BE_NULL, INTERRUPTED_WHILE_OBTAINING_LOCK
-
Constructor Summary
ConstructorsConstructorDescriptionMongoDbChannelMessageStore
(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
protected Message<?>
doPollMessageFromGroup
(Object groupId) getMessageGroup
(Object groupId) Not fully used.boolean
void
setPriorityEnabled
(boolean priorityEnabled) Methods inherited from class org.springframework.integration.mongodb.store.AbstractConfigurableMongoDbMessageStore
addMessageDocument, afterPropertiesSet, doAddMessagesToGroup, doCompleteGroup, doRemoveMessageGroup, doRemoveMessagesFromGroup, doSetGroupCondition, doSetLastReleasedSequenceNumberForGroup, getApplicationContext, getMappingMongoConverter, getMessage, getMessageBuilderFactory, getMessageMetadata, getMessagesForGroup, getMongoTemplate, getNextId, getOneMessageFromGroup, groupIdQuery, iterator, messageGroupSize, setApplicationContext, setCreateIndexes
Methods inherited from class org.springframework.integration.store.AbstractMessageGroupStore
addMessagesToGroup, completeGroup, copy, doRemoveMessageFromGroupById, executeLocked, executeLocked, expireMessageGroups, getGroupMetadata, getLockRegistry, getMessageCountForAllMessageGroups, getMessageGroupCount, getMessageGroupFactory, isTimeoutOnIdle, pollMessageFromGroup, registerMessageGroupExpiryCallback, removeMessageFromGroupById, removeMessageGroup, removeMessagesFromGroup, removeMessagesFromGroup, setExpiryCallbacks, setGroupCondition, setLastReleasedSequenceNumberForGroup, setLazyLoadMessageGroups, setLockRegistry, 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, pollMessageFromGroup, removeMessageGroup
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.springframework.integration.store.MessageGroupStore
getMessageFromGroup, 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.
-
doPollMessageFromGroup
- Specified by:
doPollMessageFromGroup
in classAbstractMessageGroupStore
-