Class MongoDbMessageStore
java.lang.Object
org.springframework.integration.store.AbstractBatchingMessageGroupStore
org.springframework.integration.store.AbstractMessageGroupStore
org.springframework.integration.mongodb.store.MongoDbMessageStore
- All Implemented Interfaces:
java.lang.Iterable<org.springframework.integration.store.MessageGroup>,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.integration.store.BasicMessageGroupStore,org.springframework.integration.store.MessageGroupStore,org.springframework.integration.store.MessageStore
public class MongoDbMessageStore
extends org.springframework.integration.store.AbstractMessageGroupStore
implements org.springframework.integration.store.MessageStore, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
An implementation of both the
MessageStore and
MessageGroupStore
strategies that relies upon MongoDB for persistence.- Since:
- 2.1
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSEQUENCE_NAME -
Constructor Summary
Constructors Constructor Description MongoDbMessageStore(org.springframework.data.mongodb.MongoDatabaseFactory mongoDbFactory)Create a MongoDbMessageStore using the providedMongoDatabaseFactory.and the default collection name.MongoDbMessageStore(org.springframework.data.mongodb.MongoDatabaseFactory mongoDbFactory, java.lang.String collectionName)Create a MongoDbMessageStore using the providedMongoDatabaseFactoryand collection name. -
Method Summary
Modifier and Type Method Description voidaddAllowedPatterns(java.lang.String... patterns)Add patterns for packages/classes that are allowed to be deserialized.<T> org.springframework.messaging.Message<T>addMessage(org.springframework.messaging.Message<T> message)voidaddMessagesToGroup(java.lang.Object groupId, org.springframework.messaging.Message<?>... messages)voidafterPropertiesSet()voidcompleteGroup(java.lang.Object groupId)org.springframework.messaging.Message<?>getMessage(java.util.UUID id)longgetMessageCount()intgetMessageCountForAllMessageGroups()org.springframework.integration.store.MessageGroupgetMessageGroup(java.lang.Object groupId)intgetMessageGroupCount()org.springframework.integration.store.MessageMetadatagetMessageMetadata(java.util.UUID id)java.util.Collection<org.springframework.messaging.Message<?>>getMessagesForGroup(java.lang.Object groupId)org.springframework.messaging.Message<?>getOneMessageFromGroup(java.lang.Object groupId)java.util.Iterator<org.springframework.integration.store.MessageGroup>iterator()intmessageGroupSize(java.lang.Object groupId)org.springframework.messaging.Message<?>pollMessageFromGroup(java.lang.Object groupId)org.springframework.messaging.Message<?>removeMessage(java.util.UUID id)voidremoveMessageGroup(java.lang.Object groupId)voidremoveMessagesFromGroup(java.lang.Object groupId, java.util.Collection<org.springframework.messaging.Message<?>> messages)voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)voidsetBeanClassLoader(java.lang.ClassLoader classLoader)voidsetCustomConverters(java.lang.Object... customConverters)Configure a set of converters to use in theMappingMongoConverter.voidsetLastReleasedSequenceNumberForGroup(java.lang.Object groupId, int sequenceNumber)java.util.stream.Stream<org.springframework.messaging.Message<?>>streamMessagesForGroup(java.lang.Object groupId)Methods inherited from class org.springframework.integration.store.AbstractMessageGroupStore
addMessageToGroup, copy, expireMessageGroups, getGroupMetadata, getMessageGroupFactory, isTimeoutOnIdle, registerMessageGroupExpiryCallback, removeMessagesFromGroup, setExpiryCallbacks, setLazyLoadMessageGroups, setTimeoutOnIdleMethods inherited from class org.springframework.integration.store.AbstractBatchingMessageGroupStore
getRemoveBatchSize, setMessageGroupFactory, setRemoveBatchSize
-
Field Details
-
SEQUENCE_NAME
public static final java.lang.String SEQUENCE_NAME- See Also:
- Constant Field Values
-
-
Constructor Details
-
MongoDbMessageStore
public MongoDbMessageStore(org.springframework.data.mongodb.MongoDatabaseFactory mongoDbFactory)Create a MongoDbMessageStore using the providedMongoDatabaseFactory.and the default collection name.- Parameters:
mongoDbFactory- The mongodb factory.
-
MongoDbMessageStore
public MongoDbMessageStore(org.springframework.data.mongodb.MongoDatabaseFactory mongoDbFactory, @Nullable java.lang.String collectionName)Create a MongoDbMessageStore using the providedMongoDatabaseFactoryand collection name.- Parameters:
mongoDbFactory- The mongodb factory.collectionName- The collection name.
-
-
Method Details
-
setBeanClassLoader
public void setBeanClassLoader(java.lang.ClassLoader classLoader)- Specified by:
setBeanClassLoaderin interfaceorg.springframework.beans.factory.BeanClassLoaderAware
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
addAllowedPatterns
public void addAllowedPatterns(java.lang.String... patterns)Add patterns for packages/classes that are allowed to be deserialized. A class can be fully qualified or a wildcard '*' is allowed at the beginning or end of the class name. Examples:com.foo.*,*.MyClass.- Parameters:
patterns- the patterns.- Since:
- 5.4
-
setCustomConverters
public void setCustomConverters(java.lang.Object... customConverters)Configure a set of converters to use in theMappingMongoConverter. Must be instances oforg.springframework.core.convert.converter.Converter,org.springframework.core.convert.converter.ConverterFactory,org.springframework.core.convert.converter.GenericConverterororg.springframework.data.convert.ConverterBuilder.ConverterAware.- Parameters:
customConverters- the converters to use.- Since:
- 5.1.6
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
addMessage
public <T> org.springframework.messaging.Message<T> addMessage(org.springframework.messaging.Message<T> message)- Specified by:
addMessagein interfaceorg.springframework.integration.store.MessageStore
-
getMessage
public org.springframework.messaging.Message<?> getMessage(java.util.UUID id)- Specified by:
getMessagein interfaceorg.springframework.integration.store.MessageStore
-
getMessageMetadata
public org.springframework.integration.store.MessageMetadata getMessageMetadata(java.util.UUID id)- Specified by:
getMessageMetadatain interfaceorg.springframework.integration.store.MessageStore
-
getMessageCount
@ManagedAttribute public long getMessageCount()- Specified by:
getMessageCountin interfaceorg.springframework.integration.store.MessageStore
-
removeMessage
public org.springframework.messaging.Message<?> removeMessage(java.util.UUID id)- Specified by:
removeMessagein interfaceorg.springframework.integration.store.MessageStore
-
getMessageGroup
public org.springframework.integration.store.MessageGroup getMessageGroup(java.lang.Object groupId)- Specified by:
getMessageGroupin interfaceorg.springframework.integration.store.BasicMessageGroupStore
-
addMessagesToGroup
public void addMessagesToGroup(java.lang.Object groupId, org.springframework.messaging.Message<?>... messages)- Specified by:
addMessagesToGroupin interfaceorg.springframework.integration.store.MessageGroupStore
-
removeMessagesFromGroup
public void removeMessagesFromGroup(java.lang.Object groupId, java.util.Collection<org.springframework.messaging.Message<?>> messages)- Specified by:
removeMessagesFromGroupin interfaceorg.springframework.integration.store.MessageGroupStore
-
removeMessageGroup
public void removeMessageGroup(java.lang.Object groupId)- Specified by:
removeMessageGroupin interfaceorg.springframework.integration.store.BasicMessageGroupStore
-
iterator
public java.util.Iterator<org.springframework.integration.store.MessageGroup> iterator()- Specified by:
iteratorin interfacejava.lang.Iterable<org.springframework.integration.store.MessageGroup>- Specified by:
iteratorin interfaceorg.springframework.integration.store.MessageGroupStore
-
pollMessageFromGroup
public org.springframework.messaging.Message<?> pollMessageFromGroup(java.lang.Object groupId)- Specified by:
pollMessageFromGroupin interfaceorg.springframework.integration.store.BasicMessageGroupStore
-
messageGroupSize
public int messageGroupSize(java.lang.Object groupId)- Specified by:
messageGroupSizein interfaceorg.springframework.integration.store.BasicMessageGroupStore
-
setLastReleasedSequenceNumberForGroup
public void setLastReleasedSequenceNumberForGroup(java.lang.Object groupId, int sequenceNumber)- Specified by:
setLastReleasedSequenceNumberForGroupin interfaceorg.springframework.integration.store.MessageGroupStore
-
completeGroup
public void completeGroup(java.lang.Object groupId)- Specified by:
completeGroupin interfaceorg.springframework.integration.store.MessageGroupStore
-
getOneMessageFromGroup
public org.springframework.messaging.Message<?> getOneMessageFromGroup(java.lang.Object groupId)- Specified by:
getOneMessageFromGroupin interfaceorg.springframework.integration.store.MessageGroupStore
-
getMessagesForGroup
public java.util.Collection<org.springframework.messaging.Message<?>> getMessagesForGroup(java.lang.Object groupId)- Specified by:
getMessagesForGroupin interfaceorg.springframework.integration.store.MessageGroupStore
-
streamMessagesForGroup
public java.util.stream.Stream<org.springframework.messaging.Message<?>> streamMessagesForGroup(java.lang.Object groupId)- Specified by:
streamMessagesForGroupin interfaceorg.springframework.integration.store.MessageGroupStore
-
getMessageCountForAllMessageGroups
@ManagedAttribute public int getMessageCountForAllMessageGroups()- Specified by:
getMessageCountForAllMessageGroupsin interfaceorg.springframework.integration.store.MessageGroupStore- Overrides:
getMessageCountForAllMessageGroupsin classorg.springframework.integration.store.AbstractMessageGroupStore
-
getMessageGroupCount
@ManagedAttribute public int getMessageGroupCount()- Specified by:
getMessageGroupCountin interfaceorg.springframework.integration.store.MessageGroupStore- Overrides:
getMessageGroupCountin classorg.springframework.integration.store.AbstractMessageGroupStore
-