Class AbstractPlatformMessage

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addMessageHistory​(MessageHistory msg)
      Adds a piece of message history.
      void addMessageHistory​(java.util.List<MessageHistory> historyList)
      Adds a list of history.
      AbstractPlatformMessage clone()
      Clones the object and resets message ID to -1.
      boolean equals​(java.lang.Object other)
      java.util.UUID getClientId()
      Gets the client to which this message belongs (may have originated with the client or be a response to the client).
      long getEstimatedSize()  
      java.util.List<MessageHistory> getMessageHistory()
      Gets this message's history.
      MessageId getMessageId()
      Gets the message id associated with the message.
      MessageMetadata getMetadata()
      Gets the message metadata from this message.
      java.lang.Object getProperty​(java.lang.String key)
      Gets an arbitrary property for the message.
      boolean getProperty​(java.lang.String key, boolean defaultValue)
      Gets a boolean property with a default value if not set.
      int getProperty​(java.lang.String key, int defaultValue)
      Gets an int property with a default value if not set.
      long getProperty​(java.lang.String key, long defaultValue)
      Gets a long property with a default value if not set.
      java.lang.Object getProperty​(java.lang.String key, java.lang.Object defaultValue)
      Gets an object property with a default value if not set.
      java.lang.String getProperty​(java.lang.String key, java.lang.String defaultValue)
      Gets a string property with a default value if not set.
      WorkflowQueue getWorkflowQueue()
      Gets the workflow queue.
      WorkflowQueue getWorkflowQueue​(boolean createIfNull)
      Optionally creates a new empty queue if null.
      int hashCode()
      boolean hasProperty​(java.lang.String key)
      Used to determine if a message has a property named key set or not.
      boolean isRedelivered()
      Returns true if the message (or its originating message) is re-delivered Redelivery is generally due to a failure and subsequent recovery in a fault tolerant system.
      void removeProperty​(java.lang.String key)
      Removes a property from the message.
      WorkflowQueue removeWorkflowQueue()
      Remove the workflow queue for this message.
      void setClientId​(java.util.UUID clientId)
      Sets the client to which this message belongs.
      void setMessageId​(MessageId msgId)
      Sets the message id associated with the message.
      void setProperty​(java.lang.String key, java.lang.Object value)
      Sets an arbitrary property for the message.
      void setRedelivered​(boolean redelivered)
      Sets the re-delivered flag.
      void setWorkflowQueue​(WorkflowQueue workflowQueue)
      Sets the workflow queue.
      void setWorkflowQueue​(java.lang.String... workflows)
      Sets the workflow queue.
      java.lang.String toMessageString()
      Gets a string-based representation of the message containing string data only.
      java.lang.String toString()
      protected java.lang.StringBuilder toString​(java.lang.StringBuilder buffer)
      Append the string form of this request to buffer.
      protected static void toString​(java.lang.StringBuilder buffer, java.lang.String label, boolean value, boolean defaultValue)
      Helper method for constructing toString for PlatformMessages.
      protected static void toString​(java.lang.StringBuilder buffer, java.lang.String label, int value)
      Helper method for constructing toString for PlatformMessages.
      protected static void toString​(java.lang.StringBuilder buffer, java.lang.String label, int value, int defaultValue)
      Helper method for constructing toString for PlatformMessages.
      protected static void toString​(java.lang.StringBuilder buffer, java.lang.String label, long value)
      Helper method for constructing toString for PlatformMessages.
      protected static void toString​(java.lang.StringBuilder buffer, java.lang.String label, long value, long defaultValue)
      Helper method for constructing toString for PlatformMessages.
      protected static <V> void toString​(java.lang.StringBuilder buffer, java.lang.String label, V value)
      Helper method for constructing toString for PlatformMessages.
      protected static <V> void toString​(java.lang.StringBuilder buffer, java.lang.String label, V[] value)
      Helper method for constructing toString for PlatformMessages.
      protected static <V> void toString​(java.lang.StringBuilder buffer, java.lang.String label, V value, V defaultValue)
      Helper method for constructing toString for PlatformMessages.
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AbstractPlatformMessage

        public AbstractPlatformMessage()
        Creates a message with no client ID
      • AbstractPlatformMessage

        public AbstractPlatformMessage​(java.util.UUID cid)
        Creates a message based on a client ID.
        Parameters:
        cid - the client ID
      • AbstractPlatformMessage

        public AbstractPlatformMessage​(java.util.UUID cid,
                                       java.lang.String... workflows)
        Creates a message based on a client ID.
        Parameters:
        cid - the client ID
        workflows - the array of workflows
      • AbstractPlatformMessage

        public AbstractPlatformMessage​(java.util.UUID cid,
                                       WorkflowQueue workflows)
        Creates a message based on a client ID and a workflow queue.
        Parameters:
        cid - the client ID
        workflows - the workflow queue
    • Method Detail

      • removeProperty

        public void removeProperty​(java.lang.String key)
        Removes a property from the message.
        Specified by:
        removeProperty in interface PlatformMessage
      • getProperty

        public java.lang.Object getProperty​(java.lang.String key)
        Gets an arbitrary property for the message. Some transformations of messages may result in the value being converted to a String.
        Specified by:
        getProperty in interface PlatformMessage
        Parameters:
        key - the key
        Returns:
        property value
      • getProperty

        public java.lang.Object getProperty​(java.lang.String key,
                                            java.lang.Object defaultValue)
        Gets an object property with a default value if not set.
        Parameters:
        key -
        defaultValue -
        Returns:
        the property value or defaultValue if not set.
      • getProperty

        public java.lang.String getProperty​(java.lang.String key,
                                            java.lang.String defaultValue)
        Gets a string property with a default value if not set.
        Parameters:
        key -
        defaultValue -
        Returns:
        the property value or defaultValue if not set.
      • getProperty

        public int getProperty​(java.lang.String key,
                               int defaultValue)
        Gets an int property with a default value if not set.
        Parameters:
        key -
        defaultValue -
        Returns:
        the property value or defaultValue if not set.
      • getProperty

        public long getProperty​(java.lang.String key,
                                long defaultValue)
        Gets a long property with a default value if not set.
        Parameters:
        key -
        defaultValue -
        Returns:
        the property value or defaultValue if not set.
      • getProperty

        public boolean getProperty​(java.lang.String key,
                                   boolean defaultValue)
        Gets a boolean property with a default value if not set.
        Parameters:
        key -
        defaultValue -
        Returns:
        the property value or defaultValue if not set.
      • setProperty

        public void setProperty​(java.lang.String key,
                                java.lang.Object value)
        Sets an arbitrary property for the message. Some transformations of messages may result in the value being converted to a String.
        Specified by:
        setProperty in interface PlatformMessage
        Parameters:
        key - the key
        value - the value
      • hasProperty

        public boolean hasProperty​(java.lang.String key)
        Used to determine if a message has a property named key set or not.
        Parameters:
        key -
        Returns:
        true if the message has the property key
      • getClientId

        public java.util.UUID getClientId()
        Gets the client to which this message belongs (may have originated with the client or be a response to the client).
        Specified by:
        getClientId in interface PlatformMessage
        Returns:
        the client ID
      • setClientId

        public void setClientId​(java.util.UUID clientId)
        Sets the client to which this message belongs.
        Specified by:
        setClientId in interface PlatformMessage
        Parameters:
        clientId - the client ID
      • getMessageId

        public MessageId getMessageId()
        Gets the message id associated with the message. message ids are used for internal ordering guarantees and may change as the message propagates through the system.
        Specified by:
        getMessageId in interface PlatformMessage
        Returns:
        the message ID
      • setMessageId

        public void setMessageId​(MessageId msgId)
        Sets the message id associated with the message.
        Specified by:
        setMessageId in interface PlatformMessage
        Parameters:
        msgId - the message ID
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toMessageString

        public java.lang.String toMessageString()
        Gets a string-based representation of the message containing string data only.
        Specified by:
        toMessageString in interface PlatformMessage
        Returns:
        the message string
      • toString

        protected java.lang.StringBuilder toString​(java.lang.StringBuilder buffer)
        Append the string form of this request to buffer.
      • getWorkflowQueue

        public WorkflowQueue getWorkflowQueue()
        Gets the workflow queue. Modifying the returned value will change the workflow destinations for the message.
        Specified by:
        getWorkflowQueue in interface PlatformMessage
        Returns:
        the workflow queue, may be null.
      • getWorkflowQueue

        public WorkflowQueue getWorkflowQueue​(boolean createIfNull)
        Optionally creates a new empty queue if null. Modifying the returned value will change the workflow destinations for the message.
        Specified by:
        getWorkflowQueue in interface PlatformMessage
        Parameters:
        createIfNull - if true and the queue is not set, creates a new empty queue
        Returns:
        the workflow queue
      • removeWorkflowQueue

        public WorkflowQueue removeWorkflowQueue()
        Remove the workflow queue for this message.
        Returns:
        the WorkflowQueue that was previously set on this message.
      • setWorkflowQueue

        public void setWorkflowQueue​(WorkflowQueue workflowQueue)
        Sets the workflow queue. wfQueue will be cloned.
        Specified by:
        setWorkflowQueue in interface PlatformMessage
        Parameters:
        workflowQueue - the workflow queue
      • setWorkflowQueue

        public void setWorkflowQueue​(java.lang.String... workflows)
        Sets the workflow queue. wfQueue will be cloned.
        Specified by:
        setWorkflowQueue in interface PlatformMessage
        Parameters:
        workflows - the list of workflows
      • isRedelivered

        public boolean isRedelivered()
        Returns true if the message (or its originating message) is re-delivered Redelivery is generally due to a failure and subsequent recovery in a fault tolerant system.
        Specified by:
        isRedelivered in interface PlatformMessage
        Returns:
        true if the message is re-delivered
      • setRedelivered

        public void setRedelivered​(boolean redelivered)
        Sets the re-delivered flag.
        Specified by:
        setRedelivered in interface PlatformMessage
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • clone

        public AbstractPlatformMessage clone()
        Clones the object and resets message ID to -1. Clones a message. The message ID is not cloned.
        Specified by:
        clone in interface PlatformMessage
        Overrides:
        clone in class java.lang.Object
        Returns:
        the cloned index message
      • toString

        protected static final void toString​(java.lang.StringBuilder buffer,
                                             java.lang.String label,
                                             boolean value,
                                             boolean defaultValue)
        Helper method for constructing toString for PlatformMessages.
      • toString

        protected static final void toString​(java.lang.StringBuilder buffer,
                                             java.lang.String label,
                                             int value)
        Helper method for constructing toString for PlatformMessages.
      • toString

        protected static final void toString​(java.lang.StringBuilder buffer,
                                             java.lang.String label,
                                             int value,
                                             int defaultValue)
        Helper method for constructing toString for PlatformMessages.
      • toString

        protected static final void toString​(java.lang.StringBuilder buffer,
                                             java.lang.String label,
                                             long value)
        Helper method for constructing toString for PlatformMessages.
      • toString

        protected static final void toString​(java.lang.StringBuilder buffer,
                                             java.lang.String label,
                                             long value,
                                             long defaultValue)
        Helper method for constructing toString for PlatformMessages.
      • toString

        protected static final <V> void toString​(java.lang.StringBuilder buffer,
                                                 java.lang.String label,
                                                 V value)
        Helper method for constructing toString for PlatformMessages.
      • toString

        protected static final <V> void toString​(java.lang.StringBuilder buffer,
                                                 java.lang.String label,
                                                 V value,
                                                 V defaultValue)
        Helper method for constructing toString for PlatformMessages.
      • toString

        protected static final <V> void toString​(java.lang.StringBuilder buffer,
                                                 java.lang.String label,
                                                 V[] value)
        Helper method for constructing toString for PlatformMessages.