Class JMSTextMessage

  • All Implemented Interfaces:
    JmsMessage,, javax.jms.Message, javax.jms.TextMessage

    public class JMSTextMessage
    extends JMSMessage
    implements javax.jms.TextMessage

    A TextMessage is used to send a message containing a java.lang.String. It inherits from JMSMessage and adds a text body.

    When a client receives a TextMessage, it is in read-only mode. If a client attempts to write to the message at this point, a MessageNotWriteableException is thrown. If clearBody() is called, the message can then be both read from and written to.

    To create a text message please call Session.createTextMessage(). Do not call the default constructor.

    See Also:
    Serialized Form
    • Field Detail

      • sccsid

        public static final java.lang.String sccsid
        The SCCSID which is expanded when the file is extracted from CMVC
        See Also:
        Constant Field Values
    • Constructor Detail

      • JMSTextMessage

        public JMSTextMessage()

        To create a text message please call Session.createTextMessage().

        Do not call this default constructor.

    • Method Detail

      • getText

        public java.lang.String getText()
                                 throws javax.jms.JMSException
        Gets the String containing this message's data. The default value is null.
        Specified by:
        getText in interface javax.jms.TextMessage
        the message data in String form
        javax.jms.JMSException - if the character set is not supported
      • setText

        public void setText(java.lang.String messageText)
                     throws javax.jms.JMSException
        Sets the String containing this message's data.
        Specified by:
        setText in interface javax.jms.TextMessage
        messageText - the String containing the message's data
        javax.jms.JMSException - if an internal error occurs
        javax.jms.MessageNotWriteableException - if the message is in read-only mode
(c) Copyright IBM Corp. 2008, 2016. All Rights Reserved.