Class MessageStoreEntry

java.lang.Object
de.otto.synapse.messagestore.MessageStoreEntry
All Implemented Interfaces:
Serializable

public final class MessageStoreEntry extends Object implements Serializable
An entry in a MessageStore which is a TextMessage stored with some extra data about the origin of the message.
See Also:
  • Method Details

    • of

      public static MessageStoreEntry of(@Nonnull String channelName, @Nonnull TextMessage textMessage)
      Creates a new entry from channelName and the textMessage.
      Parameters:
      channelName - the name of the channel that was the origin of the TextMessage
      textMessage - the TextMessage of the MessageStoreEntry
      Returns:
      MessageStoreEntry
    • of

      public static MessageStoreEntry of(@Nonnull String channelName, @Nonnull com.google.common.collect.ImmutableMap<Index,String> filterValues, @Nonnull TextMessage textMessage)
      Creates a new entry from channelName, filterValues and the textMessage.

      The filterValues parameter contains extra information about the entry. The values will typically be created by one or more Indexers, when the MessageStoreEntry is added to an indexing MessageStore like, for example, RedisIndexedMessageStore.

      Especially in distributed MessageStore implementations, with multiple consumers listening at a single channel, this information can be used to fetch messages that was added to the MessageStore by a single service.

      Parameters:
      channelName - the name of the channel that was the origin of the TextMessage
      filterValues - extra information used to filter entries
      textMessage - the TextMessage of the MessageStoreEntry
      Returns:
      MessageStoreEntry
    • getChannelName

      @Nonnull public String getChannelName()
      Returns the channel name of the channel that was used to transmit the message.
      Returns:
      channel name
    • getFilterValues

      @Nonnull public com.google.common.collect.ImmutableMap<Index,String> getFilterValues()
      Extra filtering information about the entry.

      The values will typically be created by one or more Indexers, when the MessageStoreEntry is added to an indexing MessageStore like, for example, RedisIndexedMessageStore.

      The keys of the filter values should be derived from Index.getName() ()} of the index updated by the Indexer.

      Returns:
      filter values
    • getTextMessage

      @Nonnull public TextMessage getTextMessage()
      The message transmitted over the channel
      Returns:
      message
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object