Interface MessageStore

All Known Implementing Classes:
AbstractKeyValueMessageStore, ConfigurableMongoDbMessageStore, GemfireMessageStore, JdbcMessageStore, MongoDbMessageStore, RedisMessageStore, SimpleMessageStore

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

    • getMessage

      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

      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 return value can be different than 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

      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.
      Parameters:
      id - THe message identifier.
      Returns:
      The message.
    • 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