Class ActiveMQTextMessage

java.lang.Object
org.apache.activemq.artemis.jms.client.ActiveMQMessage
org.apache.activemq.artemis.jms.client.ActiveMQTextMessage
All Implemented Interfaces:
Message, TextMessage
Direct Known Subclasses:
ActiveMQTextCompatibleMessage

public class ActiveMQTextMessage extends ActiveMQMessage implements TextMessage
ActiveMQ Artemis implementation of a JMS TextMessage.
  • Field Details

  • Constructor Details

  • Method Details

    • getType

      public byte getType()
      Overrides:
      getType in class ActiveMQMessage
    • 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.
    • doBeforeReceive

      public void doBeforeReceive() throws ActiveMQException
      Overrides:
      doBeforeReceive in class ActiveMQMessage
      Throws:
      ActiveMQException
    • getBodyInternal

      protected <T> T getBodyInternal(Class<T> c)
      Overrides:
      getBodyInternal in class ActiveMQMessage
    • isBodyAssignableTo

      public boolean isBodyAssignableTo(Class c)
      Description copied from class: ActiveMQMessage
      From the specs:

      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.

      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