Class Message


  • public class Message
    extends java.lang.Object
    Represents a message conveyed by messaging clients.
    • Constructor Summary

      Constructors 
      Constructor Description
      Message​(java.lang.String key, java.lang.String payload)
      Constructor using an optional message key and the message payload.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getKey()
      Gets the message key.
      java.lang.String getPayload()
      Gets the message payload.
      static Message of​(java.lang.String payload)
      Factory method for a message that has a payload only.
      static Message of​(java.lang.String key, java.lang.String payload)
      Factory method for a message with payload and an additional message key.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Message

        public Message​(java.lang.String key,
                       java.lang.String payload)
        Constructor using an optional message key and the message payload.
        Parameters:
        key - The optional message key
        payload - The message payload
    • Method Detail

      • getKey

        public java.lang.String getKey()
        Gets the message key.
        Returns:
        The optional message key, may return null
      • getPayload

        public java.lang.String getPayload()
        Gets the message payload.
        Returns:
        The message payload
      • of

        public static Message of​(java.lang.String payload)
        Factory method for a message that has a payload only.
        Parameters:
        payload - The payload
        Returns:
        A new instance of Message
      • of

        public static Message of​(java.lang.String key,
                                 java.lang.String payload)
        Factory method for a message with payload and an additional message key.
        Parameters:
        key - The optional message key
        payload - The message payload
        Returns:
        A new instance of Message