Class MessageStoreEntry

  • All Implemented Interfaces:
    java.io.Serializable

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

      • of

        public static MessageStoreEntry of​(@Nonnull
                                           java.lang.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
                                           java.lang.String channelName,
                                           @Nonnull
                                           com.google.common.collect.ImmutableMap<Index,​java.lang.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 java.lang.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,​java.lang.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​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object