Class Message

  • All Implemented Interfaces:
    Message
    Direct Known Subclasses:
    AdminMessage, BytesMessage, MapMessage, ObjectMessage, StreamMessage, TextMessage

    public class Message
    extends Object
    implements Message
    Implements the javax.jms.Message interface.

    A Joram message encapsulates a proprietary message which is used for effective MOM transport facility. It defines the message header and properties, and the acknowledge method used for all messages.

    JMS messages are composed of the following parts:

    • Header - All messages support the same set of header fields. Header fields contain values used by both clients and providers to identify and route messages.
    • Properties - Each message contains a built-in facility for supporting application-defined property values. Properties provide an efficient mechanism for supporting message filtering.
    • Body - The JMS API defines several types of message body, which cover the majority of messaging styles currently in use.
    The JMS API defines five types of message body:
    • Stream - A StreamMessage object's message body contains a stream of primitive values.
    • Map - A MapMessage object's message body contains a set of name-value pairs, where names are String objects, and values are Java primitives.
    • Text - A TextMessage object's message body contains a java.lang.String object.
    • Object - An ObjectMessage object's message body contains a Serializable Java object.
    • Bytes - A BytesMessage object's message body contains a stream of uninterpreted bytes.
    • Field Detail

      • logger

        public static org.objectweb.util.monolog.api.Logger logger
      • momMsg

        protected org.objectweb.joram.shared.messages.Message momMsg
      • session

        protected transient Session session
        If the message is actually consumed, the session that consumes it, null otherwise.
      • jmsDest

        protected transient Destination jmsDest
        The JMSDestination field. This field is only use with non Joram destination.
      • RObody

        protected boolean RObody
        true if the message body is read-only.
      • propertiesRO

        public boolean propertiesRO
        true if the properties are read-only.
      • first

        private static boolean first
      • strictVerificationError

        private static boolean strictVerificationError
      • strictVerificationWarn

        private static boolean strictVerificationWarn
    • Constructor Detail

      • Message

        protected Message()
        Constructs a bright new Message.
      • Message

        protected Message​(Session session,
                          org.objectweb.joram.shared.messages.Message momMsg)
        Instantiates a Message wrapping a consumed MOM simple message.
        Parameters:
        session - The consuming session.
        momMsg - The MOM message to wrap.
    • Method Detail

      • setCompressedMinSize

        public void setCompressedMinSize​(int compressedMinSize)
        Sets the minimum size beyond which this message's body is compressed.
        Parameters:
        compressedMinSize - the minimum size beyond which this message's body is compressed
      • getCompressedMinSize

        public final int getCompressedMinSize()
        Returns the minimum size beyond which this message's body is compressed. This attribute is inherited from Session at message creation, the default value is 0 (no compression).
        Returns:
        the minimum size beyond which this message's body is compressed.
      • isCompressed

        public final boolean isCompressed()
        Returns:
        true if compressed
      • setCompressionLevel

        public final void setCompressionLevel​(int compressionLevel)
        Sets the compression level (0..9) used when this message body is compressed. This attribute is inherited from Session at message creation, the default value is 1 (Deflater.BEST_SPEED).
        Parameters:
        compressionLevel - the compression level (0-9)
      • getCompressionLevel

        public final int getCompressionLevel()
        Returns the compression level (0..9) used when this message body is compressed. This attribute is inherited from Session at message creation, the default value is 1 (Deflater.BEST_SPEED).
        Returns:
        the compression level
      • wrapMomMessage

        public static Message wrapMomMessage​(Session session,
                                             org.objectweb.joram.shared.messages.Message momMsg)
                                      throws JMSException
        Builds a Joram/JMS message from a Joram shared message.
        Parameters:
        session -
        momMsg -
        Returns:
        Throws:
        JMSException
      • acknowledge

        public void acknowledge()
                         throws JMSException
        API method. Acknowledges all previously consumed messages of the session of this consumed message.

        All consumed JMS messages support the acknowledge method for use when a client has specified that its JMS session's consumed messages are to be explicitly acknowledged. By invoking acknowledge on a consumed message, a client implicitly acknowledges all messages consumed by the session that the message was delivered to.

        Calls to acknowledge are ignored for both transacted sessions and sessions specified to use implicit acknowledgement modes.

        Messages that have been received but not acknowledged may be redelivered.

        Specified by:
        acknowledge in interface Message
        Throws:
        IllegalStateException - If the session is closed.
        JMSException - If the acknowledgement fails for any other reason.
      • clearBody

        public void clearBody()
                       throws JMSException
        API method. Clears the message's body.

        Calling this method leaves the message body in the same state as an empty body in a newly created message.

        Specified by:
        clearBody in interface Message
        Throws:
        JMSException - Actually never thrown.
      • setReadOnly

        private void setReadOnly()
        set message read-only
      • getJMSMessageID

        public final String getJMSMessageID()
                                     throws JMSException
        API method. Returns the unique message identifier.

        The JMSMessageID header field contains a value that uniquely identifies each message sent by Joram. When a message is sent, JMSMessageID is ignored, when the send or publish method returns, it contains an unique identifier assigned by Joram.

        All JMSMessageID values starts with the prefix 'ID:'.

        Specified by:
        getJMSMessageID in interface Message
        Returns:
        the unique message identifier.
        Throws:
        JMSException - Actually never thrown.
      • setJMSMessageID

        public final void setJMSMessageID​(String id)
                                   throws JMSException
        API method. Sets the message identifier.

        This field is set when a message is sent, this method can only be used to change the value for a message that has been received.

        Specified by:
        setJMSMessageID in interface Message
        Parameters:
        id - the identifier for this message.
        Throws:
        JMSException - Actually never thrown.
      • getJMSPriority

        public final int getJMSPriority()
                                 throws JMSException
        API method. Returns the message priority.

        The JMS API defines ten levels of priority value, with 0 as the lowest priority and 9 as the highest. In addition, clients should consider priorities 0-4 as gradations of normal priority and priorities 5-9 as gradations of expedited priority.

        Default prioprity is defined by Message.DEFAULT_PRIORITY.

        Specified by:
        getJMSPriority in interface Message
        Returns:
        the message priority.
        Throws:
        JMSException - Actually never thrown.
      • setJMSPriority

        public final void setJMSPriority​(int priority)
                                  throws JMSException
        API method. Sets the priority level for this message.

        This field is set when a message is sent, this method can be used to change the value for a message that has been received.

        Specified by:
        setJMSPriority in interface Message
        Parameters:
        priority - the priority of this message.
        Throws:
        JMSException - If the priority value is incorrect.
      • getJMSDestination

        public final Destination getJMSDestination()
                                            throws JMSException
        Returns the message destination. This field is set by Session.send(), it can be overloaded for received messages. API method. Returns the message destination. This field is set by the provider at sending, it contains the destination to which the message is being sent.

        When a message is sent, this field is ignored. After completion of the send or publish method, the field holds the destination specified by the method.

        When a message is received, its JMSDestination value must be equivalent to the value assigned when it was sent. This field can be overloaded for received messages.

        Specified by:
        getJMSDestination in interface Message
        Returns:
        the destination of this message.
        Throws:
        JMSException - Actually never thrown.
      • setJMSDestination

        public final void setJMSDestination​(Destination dest)
                                     throws JMSException
        API method. Set the message destination.

        This field is set when message is sent, this method can only be used to change the value for a message that has been received.

        Specified by:
        setJMSDestination in interface Message
        Parameters:
        dest - the destination for this message.
        Throws:
        JMSException - If the destination id not a Joram's one.
      • getJMSExpiration

        public final long getJMSExpiration()
                                    throws JMSException
        API method. Returns the message expiration time.

        When a message is sent, the JMSExpiration header field is ignored. After completion of the send or publish method, it holds the expiration time of the message. This is the sum of the time-to-live value specified by the client and the GMT at the time of the send or publish.

        If the time-to-live is specified as zero, JMSExpiration is set to zero to indicate that the message does not expire.

        When a message's expiration time is reached, it is either discarded or forwarded to a DeadMessageQueue.

        Specified by:
        getJMSExpiration in interface Message
        Returns:
        the time the message expires, which is the sum of the time-to-live value specified by the client and the GMT at the time of the send.
        Throws:
        JMSException - Actually never thrown.
      • setJMSExpiration

        public final void setJMSExpiration​(long expiration)
                                    throws JMSException
        API method. Sets the message's expiration value.

        This field is set when a message is sent, this method can only be used to change the value for a message that has been received.

        Specified by:
        setJMSExpiration in interface Message
        Parameters:
        expiration - the message's expiration time.
        Throws:
        JMSException - Actually never thrown.
      • getJMSRedelivered

        public final boolean getJMSRedelivered()
                                        throws JMSException
        API method. Gets an indication of whether this message is being redelivered.

        If a client receives a message with the JMSRedelivered field set, it can access the JMSXDeliveryCount property to determine the number of attempts to deliver this message.

        Specified by:
        getJMSRedelivered in interface Message
        Returns:
        true if this message is being redelivered.
        Throws:
        JMSException - Actually never thrown.
      • setJMSRedelivered

        public final void setJMSRedelivered​(boolean redelivered)
                                     throws JMSException
        API method. Specifies whether this message is being redelivered.

        This field is set at the time the message is delivered, this method can only be used to change the value for a message that has been received.

        Specified by:
        setJMSRedelivered in interface Message
        Parameters:
        redelivered - an indication of whether this message is being redelivered.
        Throws:
        JMSException - Actually never thrown.
      • getJMSReplyTo

        public final Destination getJMSReplyTo()
                                        throws JMSException
        API method. Gets the Destination object to which a reply to this message should be sent.
        Specified by:
        getJMSReplyTo in interface Message
        Returns:
        Destination to which to send a response to this message.
        Throws:
        JMSException - Actually never thrown.
      • setJMSReplyTo

        public final void setJMSReplyTo​(Destination replyTo)
                                 throws JMSException
        API method. Sets the Destination object to which a reply to this message should be sent.

        The JMSReplyTo header field contains the destination where a reply to the current message should be sent. The destination may be either a Queue object or a Topic object.

        Specified by:
        setJMSReplyTo in interface Message
        Parameters:
        replyTo - Destination to which to send a response to this message.
        Throws:
        JMSException - If the destination id not a Joram's one.
      • getJMSTimestamp

        public final long getJMSTimestamp()
                                   throws JMSException
        API method. Returns the message time stamp.

        The JMSTimestamp header field contains the time a message was handed off to Joram to be sent. It is not the time the message was actually transmitted, because the actual send may occur later due to transactions or other client-side queueing of messages.

        When a message is sent, JMSTimestamp is ignored. When the send or publish method returns, it contains a time value somewhere in the interval between the call and the return.

        Since timestamps take some effort to create and increase a message's size, some Joram allows to optimize message overhead if they are given a hint that the timestamp is not used by an application. By calling the MessageProducer.setDisableMessageTimestamp method, a JMS client enables this potential optimization for all messages sent by that message producer.

        Specified by:
        getJMSTimestamp in interface Message
        Returns:
        the message timestamp.
        Throws:
        JMSException - Actually never thrown.
      • setJMSTimestamp

        public final void setJMSTimestamp​(long timestamp)
                                   throws JMSException
        API method. Sets the message timestamp.

        This field is set when a message is sent, this method can only be used to change the value for a message that has been received.

        Specified by:
        setJMSTimestamp in interface Message
        Parameters:
        timestamp - the timestamp for this message.
        Throws:
        JMSException - Actually never thrown.
      • getJMSCorrelationID

        public final String getJMSCorrelationID()
                                         throws JMSException
        API method. Returns the message correlation identifier.
        Specified by:
        getJMSCorrelationID in interface Message
        Returns:
        the correlation ID for the message.
        Throws:
        JMSException - Actually never thrown.
      • setJMSCorrelationID

        public final void setJMSCorrelationID​(String correlationID)
                                       throws JMSException
        API method. Sets the correlation identifier for the message.

        A client can use the JMSCorrelationID header field to link one message with another. A typical use is to link a response message with its request message.

        Specified by:
        setJMSCorrelationID in interface Message
        Parameters:
        correlationID - the message ID of a message being referred to.
        Throws:
        JMSException - Actually never thrown.
      • getJMSCorrelationIDAsBytes

        public final byte[] getJMSCorrelationIDAsBytes()
                                                throws JMSException
        API method. Gets the correlation ID as an array of bytes for the message.
        Specified by:
        getJMSCorrelationIDAsBytes in interface Message
        Returns:
        the correlation ID for the message as an array of bytes.
        Throws:
        JMSException - Actually never thrown.
      • setJMSCorrelationIDAsBytes

        public final void setJMSCorrelationIDAsBytes​(byte[] correlationID)
                                              throws JMSException
        API method. Sets the correlation ID as an array of bytes for the message.

        The use of a byte[] value for JMSCorrelationID is non-portable.

        Specified by:
        setJMSCorrelationIDAsBytes in interface Message
        Parameters:
        correlationID - the message ID value as an array of bytes.
        Throws:
        JMSException - Actually never thrown.
      • getJMSDeliveryMode

        public final int getJMSDeliveryMode()
                                     throws JMSException
        API method. Gets the DeliveryMode value specified for this message.

        The delivery modes supported are DeliveryMode.PERSISTENT and DeliveryMode.NON_PERSISTENT.

        Specified by:
        getJMSDeliveryMode in interface Message
        Returns:
        the delivery mode for this message.
        Throws:
        JMSException - Actually never thrown.
        See Also:
        DeliveryMode
      • setJMSDeliveryMode

        public final void setJMSDeliveryMode​(int deliveryMode)
                                      throws JMSException
        API method. Sets the DeliveryMode value for this message.

        JMS providers set this field when a message is sent. This method can be used to change the value for a message that has been received.

        Specified by:
        setJMSDeliveryMode in interface Message
        Parameters:
        deliveryMode - the delivery mode for this message.
        Throws:
        JMSException - If the delivery mode is incorrect.
      • getJMSType

        public final String getJMSType()
                                throws JMSException
        API method. Gets the message type identifier supplied by the client when the message was sent.
        Specified by:
        getJMSType in interface Message
        Returns:
        the message type
        Throws:
        JMSException - Actually never thrown.
      • setJMSType

        public final void setJMSType​(String type)
                              throws JMSException
        API method. Sets the message type.

        Joram does not define a standard message definition repository, this field can be used freely by the JMS applications.

        Specified by:
        setJMSType in interface Message
        Parameters:
        type - the message type.
        Throws:
        JMSException - Actually never thrown.
      • resetPropertiesRO

        public final void resetPropertiesRO()
                                     throws JMSException
        Resets the read-only flag, in order to allow the modification of message properties.
        Throws:
        JMSException - Actually never thrown.
      • propertyExists

        public final boolean propertyExists​(String name)
                                     throws JMSException
        API method. Indicates whether a property value exists.
        Specified by:
        propertyExists in interface Message
        Parameters:
        name - the name of the property to test.
        Returns:
        true if the property exists.
        Throws:
        JMSException - Actually never thrown.
      • getProperties

        public void getProperties​(Map h)
        Copies all of the mappings from the properties of this message to the specified map. These mappings will replace any mappings that this Map had for any of the keys currently in the properties.
      • getPropertyNames

        public final Enumeration getPropertyNames()
                                           throws JMSException
        API method. Returns an Enumeration of all the property names.

        Note that JMS standard header fields are not considered properties and are not returned in this enumeration.

        Specified by:
        getPropertyNames in interface Message
        Returns:
        An enumeration of all the names of property values.
        Throws:
        JMSException - Actually never thrown.
      • setBooleanProperty

        public final void setBooleanProperty​(String name,
                                             boolean value)
                                      throws JMSException
        API method. Sets a boolean property value with the specified name into the message.
        Specified by:
        setBooleanProperty in interface Message
        Parameters:
        name - The property name.
        value - The property value.
        Throws:
        MessageNotWriteableException - If the message is read-only.
        JMSException - If the property name is invalid.
      • setByteProperty

        public final void setByteProperty​(String name,
                                          byte value)
                                   throws JMSException
        API method. Sets a byte property value with the specified name into the message.
        Specified by:
        setByteProperty in interface Message
        Parameters:
        name - The property name.
        value - The property value.
        Throws:
        MessageNotWriteableException - If the message is read-only.
        JMSException - If the property name is invalid.
      • setShortProperty

        public final void setShortProperty​(String name,
                                           short value)
                                    throws JMSException
        API method. Sets a short property value with the specified name into the message.
        Specified by:
        setShortProperty in interface Message
        Parameters:
        name - The property name.
        value - The property value.
        Throws:
        MessageNotWriteableException - If the message is read-only.
        JMSException - If the property name is invalid.
      • setIntProperty

        public final void setIntProperty​(String name,
                                         int value)
                                  throws JMSException
        API method. Sets an int property value with the specified name into the message.
        Specified by:
        setIntProperty in interface Message
        Parameters:
        name - The property name.
        value - The property value.
        Throws:
        MessageNotWriteableException - If the message is read-only.
        JMSException - If the property name is invalid.
      • setLongProperty

        public final void setLongProperty​(String name,
                                          long value)
                                   throws JMSException
        API method. Sets a long property value with the specified name into the message.
        Specified by:
        setLongProperty in interface Message
        Parameters:
        name - The property name.
        value - The property value.
        Throws:
        MessageNotWriteableException - If the message is read-only.
        JMSException - If the property name is invalid.
      • setFloatProperty

        public final void setFloatProperty​(String name,
                                           float value)
                                    throws JMSException
        API method. Sets a floaf property value with the specified name into the message.
        Specified by:
        setFloatProperty in interface Message
        Parameters:
        name - The property name.
        value - The property value.
        Throws:
        MessageNotWriteableException - If the message is read-only.
        JMSException - If the property name is invalid.
      • setDoubleProperty

        public final void setDoubleProperty​(String name,
                                            double value)
                                     throws JMSException
        API method. Sets a double property value with the specified name into the message.
        Specified by:
        setDoubleProperty in interface Message
        Parameters:
        name - The property name.
        value - The property value.
        Throws:
        MessageNotWriteableException - If the message is read-only.
        JMSException - If the property name is invalid.
      • setObjectProperty

        public final void setObjectProperty​(String name,
                                            Object value)
                                     throws JMSException
        API method. Sets an object property value.

        Note that this method works only for the objectified primitive object types (Integer, Double, Long ...) and String objects.

        Specified by:
        setObjectProperty in interface Message
        Parameters:
        name - The property name.
        value - The property value.
        Throws:
        IllegalArgumentException - If the key name is illegal (null or empty string).
        MessageFormatException - If the value is not a Java primitive object.
        MessageNotWriteableException - If the message is read-only.
        JMSException - If the property name is invalid, or if the object is invalid.
      • initStrictVerification

        private static final void initStrictVerification()
      • strictVerificationError

        private static final boolean strictVerificationError()
      • strictVerificationWarn

        private static final boolean strictVerificationWarn()
      • getBooleanProperty

        public final boolean getBooleanProperty​(String name)
                                         throws JMSException
        API method. Returns the value of the boolean property with the specified name.
        Specified by:
        getBooleanProperty in interface Message
        Parameters:
        name - The property name.
        Returns:
        the property value for the specified name.
        Throws:
        MessageFormatException - If the property type is invalid.
        JMSException - If the name is invalid.
      • getByteProperty

        public final byte getByteProperty​(String name)
                                   throws JMSException
        API method. Returns the value of the byte property with the specified name.
        Specified by:
        getByteProperty in interface Message
        Parameters:
        name - The property name.
        Returns:
        the property value for the specified name.
        Throws:
        MessageFormatException - If the property type is invalid.
        JMSException - If the name is invalid.
      • getShortProperty

        public final short getShortProperty​(String name)
                                     throws JMSException
        API method. Returns the value of the short property with the specified name.
        Specified by:
        getShortProperty in interface Message
        Parameters:
        name - The property name.
        Returns:
        the property value for the specified name.
        Throws:
        MessageFormatException - If the property type is invalid.
        JMSException - If the name is invalid.
      • getIntProperty

        public final int getIntProperty​(String name)
                                 throws JMSException
        API method. Returns the value of the int property with the specified name.
        Specified by:
        getIntProperty in interface Message
        Parameters:
        name - The property name.
        Returns:
        the property value for the specified name.
        Throws:
        MessageFormatException - If the property type is invalid.
        JMSException - If the name is invalid.
      • getLongProperty

        public final long getLongProperty​(String name)
                                   throws JMSException
        API method. Returns the value of the long property with the specified name.
        Specified by:
        getLongProperty in interface Message
        Parameters:
        name - The property name.
        Returns:
        the property value for the specified name.
        Throws:
        MessageFormatException - If the property type is invalid.
        JMSException - If the name is invalid.
      • getFloatProperty

        public final float getFloatProperty​(String name)
                                     throws JMSException
        API method. Returns the value of the float property with the specified name.
        Specified by:
        getFloatProperty in interface Message
        Parameters:
        name - The property name.
        Returns:
        the property value for the specified name.
        Throws:
        MessageFormatException - If the property type is invalid.
        JMSException - If the name is invalid.
      • getDoubleProperty

        public final double getDoubleProperty​(String name)
                                       throws JMSException
        API method. Returns the value of the double property with the specified name.
        Specified by:
        getDoubleProperty in interface Message
        Parameters:
        name - The property name.
        Returns:
        the property value for the specified name.
        Throws:
        MessageFormatException - If the property type is invalid.
        JMSException - If the name is invalid.
      • getStringProperty

        public final String getStringProperty​(String name)
                                       throws JMSException
        API method. Returns the value of the String property with the specified name.
        Specified by:
        getStringProperty in interface Message
        Parameters:
        name - The property name.
        Returns:
        the property value for the specified name.
        Throws:
        MessageFormatException - If the property type is invalid.
        JMSException - If the name is invalid.
      • getObjectProperty

        public final Object getObjectProperty​(String name)
                                       throws JMSException
        API method. Returns the value of the object property with the specified name.

        This method can be used to return, in objectified format, an object that has been stored as a property in the message with the equivalent setObjectProperty method call, or its equivalent primitive settypeProperty method.

        Specified by:
        getObjectProperty in interface Message
        Parameters:
        name - The property name.
        Returns:
        the Java object property value with the specified name, in objectified format; if there is no property by this name, a null value is returned.
        Throws:
        JMSException - If the name is invalid.
      • doGetProperty

        private final Object doGetProperty​(String name)
        Method actually getting a property.
        Parameters:
        name - The property name.
        Returns:
        the property value for the specified name.
      • convertJMSMessage

        public static Message convertJMSMessage​(Message jmsMsg)
                                         throws JMSException
        Converts a non-Joram JMS message into a Joram message. Can be used to duplicate a message.
        Parameters:
        jmsMsg - a JMS message.
        Returns:
        a Joram message.
        Throws:
        JMSException - If an error occurs while building the message.
      • prepare

        protected void prepare()
                        throws JMSException
        Method preparing the message for sending; resets header values, and serializes the body (done in subclasses).
        Throws:
        JMSException
      • getMomMsg

        public org.objectweb.joram.shared.messages.Message getMomMsg()
        Returns:
        the momMsg
      • getRawBody

        public byte[] getRawBody()
                          throws IOException
        Returns the message body in raw format.
        Returns:
        the message body in raw format.
        Throws:
        IOException - An error occurs during body access.
      • dumpBody

        public String dumpBody()
                        throws IOException
        Returns an hex + ascii dump of the message body.
        Returns:
        The dump
        Throws:
        IOException - An error occurs during body access.
      • dumpBody

        public Appendable dumpBody​(Appendable strbuf)
                            throws IOException
        Appends an hex + ascii dump of the message body to the buffer.
        Parameters:
        strbuf -
        Returns:
        The buffer appended
        Throws:
        IOException - An error occurs during body access.
      • isBodyAssignableTo

        public boolean isBodyAssignableTo​(Class c)
                                   throws JMSException
        API 2.0 method
        Specified by:
        isBodyAssignableTo in interface Message
        Parameters:
        c - the specified type Check if the message body is capable of being assigned to specified type
        Returns:
        true if Message is TextMessage or MapMessage, or BytesMessage, or ObjectMessage when it's deserializable false otherwise
        Throws:
        JMSException - if fail to return a value due to some internal error
      • getBody

        public <T> T getBody​(Class<T> c)
                      throws JMSException
        Returns the message body as an object of the specified type. This method may be called on any type of message except for StreamMessage. The message body must be capable of being assigned to the specified type. This means that the specified class or interface must be either the same as, or a superclass or superinterface of, the class of the message body.
        Specified by:
        getBody in interface Message
        Parameters:
        c - The type to which the message body will be assigned. If the message has no body then any type may be specified and null is returned.
        If the message is a TextMessage then this parameter must be set to String.class or another type to which a String is assignable.
        If the message is a ObjectMessage then parameter must be set to java.io.Serializable.class or another type to which the body is assignable.
        If the message is a MapMessage then this parameter must be set to java.util.Map.class (or java.lang.Object.class).
        If the message is a BytesMessage then this parameter must be set to byte[].class (or java.lang.Object.class). This method will reset the BytesMessage before and after use.
        If the message is a TextMessage, ObjectMessage, MapMessage or BytesMessage and the message has no body, then the above does not apply and this parameter may be set to any type; the returned value will always be null.
        If the message is a Message (but not one of its subtypes) then this parameter may be set to any type; the returned value will always be null.
        Returns:
        the message body
        Throws:
        MessageFormatException - if the message is a StreamMessage, if the message body cannot be assigned to the specified type, or if the message is an ObjectMessage and object deserialization fails.
        JMSException - if the JMS provider fails to get the message body due to some internal error.
      • getEffectiveBody

        protected <T> T getEffectiveBody​(Class<T> c)
                                  throws JMSException
        Get message body
        Parameters:
        c - The type to which the message body will be assigned.
        Returns:
        message body
        Throws:
        JMSException - if the JMS provider fails to return a value due to some internal error.
      • getJMSDeliveryTime

        public long getJMSDeliveryTime()
                                throws JMSException
        API 2.0 Gets the message delivery time value.
        Specified by:
        getJMSDeliveryTime in interface Message
        Returns:
        the message delivery time value.
        Throws:
        JMSException - if fail to get the delivery time due to some internal error.
      • setJMSDeliveryTime

        public void setJMSDeliveryTime​(long deliveryTime)
                                throws JMSException
        API 2.0 Sets the message delivery time value.
        Specified by:
        setJMSDeliveryTime in interface Message
        Parameters:
        deliveryTime - the message delivery time value
        Throws:
        JMSException - if fail to set the delivery time due to some internal error.