Class Message<P>

java.lang.Object
de.otto.synapse.message.Message<P>
Type Parameters:
P - The type of the Message payload
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
TextMessage

public class Message<P>
extends java.lang.Object
implements java.io.Serializable
A Message is an atomic packet of data that can be transmitted on a channel.

Message

Thus to transmit data, an application must break the data into one or more packets, wrap each packet as a message, and then send the message on a channel. Likewise, a receiver application receives a message and must extract the data from the message to process it.

The message system will try repeatedly to deliver the message (e.g., transmit it from the sender to the receiver) until it succeeds.

See Also:
EIP: Message, Serialized Form
  • Constructor Details

    • Message

      protected Message​(@Nonnull Key key, @Nonnull Header header, @Nullable P payload)
  • Method Details

    • message

      public static <P> Message<P> message​(@Nonnull Key key, @Nullable P payload)
    • message

      public static <P> Message<P> message​(@Nonnull Key key, @Nonnull Header header, @Nullable P payload)
    • message

      public static <P> Message<P> message​(@Nonnull java.lang.String key, @Nullable P payload)
    • message

      public static <P> Message<P> message​(@Nonnull java.lang.String key, @Nonnull Header header, @Nullable P payload)
    • getKey

      @Nonnull public Key getKey()
    • getPayload

      @Nullable public P getPayload()
    • getHeader

      @Nonnull public Header getHeader()
    • 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
    • builder

      public static <P> Message.Builder<P> builder​(java.lang.Class<P> payloadType)
    • copyOf

      public static <P> Message.Builder<P> copyOf​(Message<P> message)