Class ActiveMQTextMessage

    • Method Detail

      • setText

        public void setText​(String text)
                     throws JMSException
        Description copied from interface: TextMessage
        Sets the string containing this message's data.
        Specified by:
        setText in interface TextMessage
        Parameters:
        text - the String containing the message's data
        Throws:
        JMSException - if the Jakarta Messaging provider fails to set the text due to some internal error.
        MessageNotWriteableException - if the message is in read-only mode.
      • getText

        public String getText()
        Description copied from interface: TextMessage
        Gets the string containing this message's data. The default value is null.
        Specified by:
        getText in interface TextMessage
        Returns:
        the String containing the message's data
      • clearBody

        public void clearBody()
                       throws JMSException
        Description copied from interface: Message
        Clears out the message body. Clearing a message's body does not clear its header values or property entries.

        If this message body was read-only, 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
        Overrides:
        clearBody in class ActiveMQMessage
        Throws:
        JMSException - if the Jakarta Messaging provider fails to clear the message body due to some internal error.
      • isBodyAssignableTo

        public boolean isBodyAssignableTo​(Class c)
        Description copied from interface: Message
        Returns whether the message body is capable of being assigned to the specified type. If this method returns true then a subsequent call to the method getBody on the same message with the same type argument would not throw a MessageFormatException.

        If the message is a StreamMessage then false is always returned. If the message is a ObjectMessage and object deserialization fails then false is returned. If the message has no body then any type may be specified and true is returned.

        Specified by:
        isBodyAssignableTo in interface Message
        Overrides:
        isBodyAssignableTo in class ActiveMQMessage
        Parameters:
        c - The specified type
        If the message is a TextMessage then this method will only return true if this parameter is set to String.class or another type to which a String is assignable.
        If the message is a ObjectMessage then this method will only return true if this parameter is set to java.io.Serializable.class or another class to which the body is assignable.
        If the message is a MapMessage then this method will only return true if this parameter is set to java.util.Map.class (or java.lang.Object.class).
        If the message is a BytesMessage then this this method will only return true if this parameter is set to byte[].class (or java.lang.Object.class).
        If the message is a TextMessage, ObjectMessage, MapMessage or BytesMessage and the message has no body, then the above does not apply and this method will return true irrespective of the value of this parameter.
        If the message is a Message (but not one of its subtypes) then this method will return true irrespective of the value of this parameter.
        Returns:
        whether the message body is capable of being assigned to the specified type