Class AbstractConfigurableMongoDbMessageStore

All Implemented Interfaces:
Iterable<MessageGroup>, Aware, InitializingBean, ApplicationContextAware, BasicMessageGroupStore, MessageGroupStore
Direct Known Subclasses:
ConfigurableMongoDbMessageStore, MongoDbChannelMessageStore

public abstract class AbstractConfigurableMongoDbMessageStore extends AbstractMessageGroupStore implements InitializingBean, ApplicationContextAware
The abstract MongoDB AbstractMessageGroupStore implementation to provide configuration for common options for implementations of this class.
Since:
4.0
Author:
Artem Bilan, Adama Sorho
  • Field Details

  • Constructor Details

    • AbstractConfigurableMongoDbMessageStore

      public AbstractConfigurableMongoDbMessageStore(MongoTemplate mongoTemplate, String collectionName)
    • AbstractConfigurableMongoDbMessageStore

      public AbstractConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory, String collectionName)
    • AbstractConfigurableMongoDbMessageStore

      public AbstractConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter, String collectionName)
  • Method Details

    • setCreateIndexes

      public void setCreateIndexes(boolean createIndexes)
      Define the option to auto create indexes or not.
      Parameters:
      createIndexes - a boolean.
      Since:
      6.0.8.
    • setApplicationContext

      public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
      Specified by:
      setApplicationContext in interface ApplicationContextAware
      Throws:
      BeansException
    • getMongoTemplate

      protected MongoTemplate getMongoTemplate()
    • getMappingMongoConverter

      protected MappingMongoConverter getMappingMongoConverter()
    • getApplicationContext

      protected ApplicationContext getApplicationContext()
    • getMessageBuilderFactory

      protected MessageBuilderFactory getMessageBuilderFactory()
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface InitializingBean
    • createIndexes

      protected void createIndexes()
    • getMessage

      public Message<?> getMessage(UUID id)
    • getMessageMetadata

      public MessageMetadata getMessageMetadata(UUID id)
    • removeMessageGroup

      public void removeMessageGroup(Object groupId)
      Description copied from interface: BasicMessageGroupStore
      Remove the message group with this id.
      Specified by:
      removeMessageGroup in interface BasicMessageGroupStore
      Parameters:
      groupId - The id of the group to remove.
    • messageGroupSize

      public int messageGroupSize(Object groupId)
      Description copied from interface: BasicMessageGroupStore
      Return the size of this MessageGroup.
      Specified by:
      messageGroupSize in interface BasicMessageGroupStore
      Parameters:
      groupId - The group identifier.
      Returns:
      The size.
    • getNextId

      protected long getNextId()
      Perform MongoDB INC operation for the document, which contains the MessageDocument sequence, and return the new incremented value for the new MessageDocument. The SEQUENCE_NAME document is created on demand.
      Returns:
      the next sequence value.
    • addMessageDocument

      protected void addMessageDocument(MessageDocument document)
    • groupIdQuery

      protected static Query groupIdQuery(Object groupId)
    • removeMessagesFromGroup

      public void removeMessagesFromGroup(Object key, Collection<Message<?>> messages)
      Description copied from interface: MessageGroupStore
      Persist the deletion of messages from the group.
      Specified by:
      removeMessagesFromGroup in interface MessageGroupStore
      Parameters:
      key - The groupId for the group containing the message(s).
      messages - The messages to be removed.
    • setGroupCondition

      public void setGroupCondition(Object groupId, String condition)
      Description copied from interface: MessageGroupStore
      Add a condition sentence into the group. Can be used later on for making some decisions for group, e.g. release strategy for correlation handler can consult this condition instead of iterating all the messages in group.
      Specified by:
      setGroupCondition in interface MessageGroupStore
      Parameters:
      groupId - The group identifier.
      condition - The condition to store into the group.
    • setLastReleasedSequenceNumberForGroup

      public void setLastReleasedSequenceNumberForGroup(Object groupId, int sequenceNumber)
      Description copied from interface: MessageGroupStore
      Allows you to set the sequence number of the last released Message. Used for Resequencing use cases
      Specified by:
      setLastReleasedSequenceNumberForGroup in interface MessageGroupStore
      Parameters:
      groupId - The group identifier.
      sequenceNumber - The sequence number.
    • iterator

      public Iterator<MessageGroup> iterator()
      Specified by:
      iterator in interface Iterable<MessageGroup>
      Specified by:
      iterator in interface MessageGroupStore
      Returns:
      The iterator of currently accumulated MessageGroups.
    • completeGroup

      public void completeGroup(Object groupId)
      Description copied from interface: MessageGroupStore
      Completes this MessageGroup. Completion of the MessageGroup generally means that this group should not be allowing anymore mutating operation to be performed on it. For example any attempt to add/remove new Message form the group should not be allowed.
      Specified by:
      completeGroup in interface MessageGroupStore
      Parameters:
      groupId - The group identifier.
    • getOneMessageFromGroup

      public Message<?> getOneMessageFromGroup(Object groupId)
      Description copied from interface: MessageGroupStore
      Return the one Message from MessageGroup.
      Specified by:
      getOneMessageFromGroup in interface MessageGroupStore
      Parameters:
      groupId - The group identifier.
      Returns:
      the Message.
    • addMessagesToGroup

      public void addMessagesToGroup(Object groupId, Message<?>... messages)
      Description copied from interface: MessageGroupStore
      Store messages with an association to a group id. This can be used to group messages together.
      Specified by:
      addMessagesToGroup in interface MessageGroupStore
      Parameters:
      groupId - The group id to store messages under.
      messages - The messages to add.
    • getMessagesForGroup

      public Collection<Message<?>> getMessagesForGroup(Object groupId)
      Description copied from interface: MessageGroupStore
      Retrieve messages for the provided group id.
      Specified by:
      getMessagesForGroup in interface MessageGroupStore
      Parameters:
      groupId - The group id to retrieve messages for.
      Returns:
      the messages for group.