Class EMessage

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int MAX_SUBJECT_LENGTH
      eBus subjects are restricted to 512 characters.
      java.lang.String subject
      The required message subject.
      long timestamp
      The message timestamp in Java millisecond epoch time.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected EMessage​(EMessage.Builder<?,​?> builder)
      Creates a new eBus message based on the given message builder.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)
      Returns true if o is a non-null EMessage instance with a subject and timestamp equal to this EMessage instance and false otherwise.
      int hashCode()
      Returns the message header hash code.
      boolean isApplicationMessage()
      Returns true if this is an application message and false otherwise.
      boolean isSystemMessage()
      Returns true if this is a system message and false otherwise.
      EMessageKey key()
      Returns the unique message key based on the message class and subject.
      EMessage.MessageType messageType()
      Returns the message type.
      java.time.Instant timestampAsInstant()
      Returns message timestamp as an Instant rather than as an epoch millisecond long.
      java.lang.String toString()
      Returns message subject and timestamp as a string.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • MAX_SUBJECT_LENGTH

        public static final int MAX_SUBJECT_LENGTH
        eBus subjects are restricted to 512 characters. eBus messages with subjects exceeding this limit cannot be created or de-serialized.
        See Also:
        Constant Field Values
      • subject

        public final java.lang.String subject
        The required message subject. The subject and the message class are used to route this message to the intended eBus clients.
      • timestamp

        public final long timestamp
        The message timestamp in Java millisecond epoch time.
    • Constructor Detail

      • EMessage

        protected EMessage​(EMessage.Builder<?,​?> builder)
        Creates a new eBus message based on the given message builder. builder is guaranteed to contain a valid message configuration at this point.
        Parameters:
        builder - contains the eBus message configuration.
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object o)
        Returns true if o is a non-null EMessage instance with a subject and timestamp equal to this EMessage instance and false otherwise.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - comparison object.
        Returns:
        true if the message fields are equal and false otherwise.
      • hashCode

        public int hashCode()
        Returns the message header hash code.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the message header hash code.
      • toString

        public java.lang.String toString()
        Returns message subject and timestamp as a string.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the message as text.
      • key

        public EMessageKey key()
        Returns the unique message key based on the message class and subject.
        Returns:
        the unique message key based on the message class and subject.
      • isSystemMessage

        public boolean isSystemMessage()
        Returns true if this is a system message and false otherwise. Only eBus is allowed to transmit a system message.
        Returns:
        true if this is a system message and false otherwise.
      • isApplicationMessage

        public boolean isApplicationMessage()
        Returns true if this is an application message and false otherwise.
        Returns:
        true if this is an application message and false otherwise.
      • timestampAsInstant

        public java.time.Instant timestampAsInstant()
        Returns message timestamp as an Instant rather than as an epoch millisecond long.
        Returns:
        message timestamp as Instant.