Class Notification

    • Field Detail

      • serialVersionUID

        static final long serialVersionUID
        define serialVersionUID for interoperability
        See Also:
        Constant Field Values
      • persistent

        protected transient boolean persistent
        True if the notification is persistent, false otherwise. By default, this field is set to true during object creation and disk loading. This field is carry by network protocol. There is no public setter for this attribute. According the fact that a notification class is or not persistent this attribute should be statically fixed in the subclass constructor.
      • detachable

        protected transient boolean detachable
        True if the notification is detachable, false otherwise. A detachable notification is saved in a different object that its containing message.
      • detached

        protected transient boolean detached
        True if the notification is detached, false otherwise. A detached notification is not destroyed in the same way that its containing message.
      • expiration

        long expiration
        The expiration date for this notification. This field is handled by the network protocol in order to fit the time synchronization problem.
      • priority

        int priority
        The priority for this notification from 0 to 9, 9 being the highest. By default, the priority is 4
      • deadNotificationAgentId

        AgentId deadNotificationAgentId
        The agentId identifying the agent to which the notification is sent when it is expired.
        Default value is null, which means the expired notification is lost.
      • messageId

        transient String messageId
        If the notification is stored independently that its containing message messageId contains the persistent name of this notification.
      • context

        private Object context
        Context of the notification. /!\ Be careful, the related object must be serialized either through Serializable or Encodable interfaces, depending of the notification serialization mode. It seems difficult to use, may be we should use a byte array handled by the application. TODO (AF): It seems never used in Joram/JoramMQ.
      • DeadNotificationAgentIdSet

        private static final byte DeadNotificationAgentIdSet
        See Also:
        Constant Field Values
    • Constructor Detail

      • Notification

        public Notification()
    • Method Detail

      • setExpiration

        public void setExpiration​(long expiration)
        Sets the expiration date for this notification. A value of 0L (default) indicates that the notification does not expire.
        Parameters:
        expiration - the expiration date for this notification.
      • getExpiration

        public long getExpiration()
        Gets the notification's expiration value. This field is handled by the network protocol in order to fit the time synchronization problem. If the expiration date is set to 0L (default), it indicates that the notification does not expire. When a notification's expiration time is reached, the MOM should discard it without any form of notification of message expiration. Agents should not receive messages that have expired; however, the MOM does not guarantee that this will not happen.
        Returns:
        The notification's expiration value.
      • setPriority

        public void setPriority​(int priority)
        Sets the priority for this notification. A value between 0 (lowest) and 9 (highest), by default 4 (normal).
        Parameters:
        priority - the priority for this notification.
      • getPriority

        public int getPriority()
        Gets the notification's priority value.
        Returns:
        The notification's priority value.
      • getMessageId

        public String getMessageId()
      • setContext

        public final void setContext​(Object context)
        Sets the context of the notification.
        Parameters:
        context - the context of the notification.
      • getContext

        public final Object getContext()
        Returns the context of the notification.
        Returns:
        the context of the notification.
      • clone

        public Object clone()
        Returns a clone of this notification.
        Overrides:
        clone in class Object
        Returns:
        a clone of this notification.
      • isPersistent

        public boolean isPersistent()
        Return true if notification is persistent.
        Returns:
        persistent of this notification.
      • getDeadNotificationAgentId

        public AgentId getDeadNotificationAgentId()
        Returns:
        The agentId identifying the agent to which the notification is sent when it is expired.
      • setDeadNotificationAgentId

        public void setDeadNotificationAgentId​(AgentId deadNotificationAgentId)
        Sets the forwardExpiredNotAgentId value which enable sending expired notifications to a specific agent
        Parameters:
        deadNotificationAgentId - the AgentId to which the dead notification is forwarded
      • writeObject

        private void writeObject​(ObjectOutputStream out)
                          throws IOException
        The writeObject method is responsible for writing the state of the object for its particular class so that the corresponding readObject method can restore it.
        Parameters:
        out - The stream to write out.
        Throws:
        IOException - if an errors occurs.
      • toString

        public StringBuilder toString​(StringBuilder output)
        Appends a string image for this object to the StringBuffer parameter.
        Parameters:
        output - buffer to fill in.
        Returns:
        the resulting buffer.
      • toString

        public final String toString()
        Provides a string image for this object.
        Overrides:
        toString in class Object
        Returns:
        a string representation for this object.
      • getEncodableClassId

        public int getEncodableClassId()
        The class id is still not defined.
        Specified by:
        getEncodableClassId in interface Encodable
        Returns:
        a unique class identifier
      • getEncodedSize

        public int getEncodedSize()
                           throws Exception
        Returns the size of the encoded object.
        Specified by:
        getEncodedSize in interface Encodable
        Returns:
        the size of the encoded object
        Throws:
        Exception - if an error occurs
      • encode

        public void encode​(Encoder encoder)
                    throws Exception
        Encodes the object.
        Specified by:
        encode in interface Encodable
        Parameters:
        encoder - the encoder
        Throws:
        Exception - if an error occurs
      • decode

        public void decode​(Decoder decoder)
                    throws Exception
        Decodes the object.
        Specified by:
        decode in interface Encodable
        Parameters:
        decoder - the encoder
        Throws:
        Exception - if an error occurs