Interface MessageStore

All Superinterfaces:
IntegrationPattern
All Known Implementing Classes:
AbstractKeyValueMessageStore, ConfigurableMongoDbMessageStore, HazelcastMessageStore, JdbcMessageStore, MongoDbMessageStore, RedisMessageStore, SimpleMessageStore

public interface MessageStore extends IntegrationPattern
Strategy interface for storing and retrieving messages.
Since:
2.0
Author:
Mark Fisher, Iwein Fuld, Dave Syer, Artem Bilan, Jiandong Ma
  • Method Details

    • getMessage

      @Nullable Message<?> getMessage(UUID id)
      Parameters:
      id - The message identifier.
      Returns:
      The Message with the given id, or null if no Message with that id exists in the MessageStore.
    • getMessageMetadata

      @Nullable MessageMetadata getMessageMetadata(UUID id)
      Return a MessageMetadata for the Message by provided id.
      Parameters:
      id - The message identifier.
      Returns:
      The MessageMetadata with the given id, or null if no Message with that id exists in the MessageStore or the message has no metadata (legacy message from an earlier version).
      Since:
      5.0
    • addMessage

      <T> Message<T> addMessage(Message<T> message)
      Put the provided Message into the MessageStore. The store may need to mutate the message internally, and if it does then the returned value can be different from the input. The id of the return value will be used as an index so that the getMessage(UUID) and removeMessage(UUID) behave properly. Since messages are immutable, putting the same message more than once is a no-op.
      Type Parameters:
      T - The payload type.
      Parameters:
      message - The message.
      Returns:
      The message that was stored.
    • removeMessage

      @Nullable Message<?> removeMessage(UUID id)
      Remove the Message with the given id from the MessageStore, if present, and return it. If no Message with that id is present in the store, this will return null. If this method is implemented on a MessageGroupStore, the message is removed from the store only if no groups holding this message.
      Parameters:
      id - the message identifier.
      Returns:
      the message (if any).
    • getMessageCount

      @ManagedAttribute long getMessageCount()
      Optional attribute giving the number of messages in the store. Implementations may decline to respond by throwing an exception.
      Returns:
      The number of messages.
      Throws:
      UnsupportedOperationException - if not implemented
    • getIntegrationPatternType

      default IntegrationPatternType getIntegrationPatternType()
      Description copied from interface: IntegrationPattern
      Return a pattern type this component implements.
      Specified by:
      getIntegrationPatternType in interface IntegrationPattern
      Returns:
      the IntegrationPatternType this component implements.