Interface IMDfromHTMLIPCMessage

  • All Known Implementing Classes:
    MDfromHTMLIPCMessage

    public interface IMDfromHTMLIPCMessage
    Interface for the MDfromHTML IPC Message to be sent (or received) across the MDfromHTML Interprocess Communications Infrastructure. Messages may carry JSONObject or byte[] content. Messages are identified by a topic (used for subscription), a type (used for identifying how a message should be parsed and interpreted), a create time, a sequence number where 0 implies the only message, 1 or greater implies a chunk of a larger message (where Integer.MAX_VALUE acks as a semaphore to signal the last of a sequence), and a flag describing if the message content is a JSONObject or byte[].
    • Method Detail

      • getApplicationValue

        int getApplicationValue()
        Returns:
        the numeric identity of the application
      • getMessage

        com.api.json.JSONObject getMessage()
                                    throws Exception
        Returns:
        the message content as a JSONObject
        Throws:
        Exception
      • getMessageBytes

        byte[] getMessageBytes()
        Returns:
        the message content as a byte[]
      • getPublisherName

        String getPublisherName()
        Returns:
        the publisher (creator) of this message
      • getSequence

        int getSequence()
        Returns:
        the sequence number of this message. Note: zero implies the only message, non-zero implies a part of a chunked message, with 65768 signifying the last of the sequence of messages.
      • getTime

        long getTime()
        Returns:
        the original message creation time (not necessarily the same as the time it was published)
      • getTopic

        String getTopic()
        Returns:
        the message topic
      • getVerbValue

        int getVerbValue()
        Retrieve the numeric identity of the verb
        Returns:
        the numeric identity of the verb
      • getVerb

        MDfromHTMLIPCVerbs getVerb()
        Retrieve the enumerated value associated with this message
        Returns:
        the enumerated value associated with this message
        See Also:
        MDfromHTMLIPCVerbs
      • getUserID

        MDfromHTMLID getUserID()
        Retrieve the user identification associated with this message
        Returns:
        the user identification associated with this message
      • isLastMessage

        boolean isLastMessage()
        Returns:
        true if the message sequence is Integer.MAX_VALUE signaling the end of a chunked sequence of messages
      • isOnlyMessage

        boolean isOnlyMessage()
        Returns:
        true if the message sequence is zero signaling the message was not chunked
      • isSequence

        boolean isSequence()
        Returns:
        true if the message sequence is not zero (for an "chunked" message).
      • isJSON

        boolean isJSON()
        Returns:
        true if the original message was a String (as opposed to a byte[])
      • toString

        String toString()
        Overrides:
        toString in class Object
        Returns:
        an abbreviated formatted version of the message (contains only the first 100 bytes of the payload)
      • toStringFull

        String toStringFull​(boolean formatJSON)
        Parameters:
        formatJSON - true if the message is to be formatted (if the message contains JSON), false if not.
        Returns:
        formatted complete version of this message
        See Also:
        that is more useful for debugging