Package de.otto.synapse.messagestore
Class MessageStoreEntry
- java.lang.Object
-
- de.otto.synapse.messagestore.MessageStoreEntry
-
- All Implemented Interfaces:
java.io.Serializable
public final class MessageStoreEntry extends java.lang.Object implements java.io.SerializableAn entry in aMessageStorewhich is aTextMessagestored with some extra data about the origin of the message.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.StringgetChannelName()Returns the channel name of the channel that was used to transmit themessage.com.google.common.collect.ImmutableMap<Index,java.lang.String>getFilterValues()Extra filtering information about the entry.TextMessagegetTextMessage()The message transmitted over thechannelinthashCode()static MessageStoreEntryof(java.lang.String channelName, com.google.common.collect.ImmutableMap<Index,java.lang.String> filterValues, TextMessage textMessage)Creates a new entry fromchannelName,filterValuesand thetextMessage.static MessageStoreEntryof(java.lang.String channelName, TextMessage textMessage)Creates a new entry fromchannelNameand thetextMessage.java.lang.StringtoString()
-
-
-
Method Detail
-
of
public static MessageStoreEntry of(@Nonnull java.lang.String channelName, @Nonnull TextMessage textMessage)
Creates a new entry fromchannelNameand thetextMessage.- Parameters:
channelName- the name of the channel that was the origin of theTextMessagetextMessage- theTextMessageof theMessageStoreEntry- 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 fromchannelName,filterValuesand thetextMessage.The
filterValuesparameter contains extra information about the entry. The values will typically be created by one or moreIndexers, when theMessageStoreEntryis added to an indexingMessageStorelike, 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
MessageStoreby a single service.- Parameters:
channelName- the name of the channel that was the origin of theTextMessagefilterValues- extra information used to filter entriestextMessage- theTextMessageof theMessageStoreEntry- Returns:
- MessageStoreEntry
-
getChannelName
@Nonnull public java.lang.String getChannelName()
Returns the channel name of the channel that was used to transmit themessage.- 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 theMessageStoreEntryis added to an indexingMessageStorelike, for example,RedisIndexedMessageStore.The keys of the filter values should be derived from
Index.getName()()} of the index updated by theIndexer.- Returns:
- filter values
-
getTextMessage
@Nonnull public TextMessage getTextMessage()
The message transmitted over thechannel- Returns:
- message
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-