Websphere MQ Everyplace

com.ibm.mqe.jms
Class MQeTextMessage

java.lang.Object
  |
  +--com.ibm.mqe.jms.MQeMessage
        |
        +--com.ibm.mqe.jms.MQeTextMessage
All Implemented Interfaces:
javax.jms.Message, javax.jms.TextMessage

public class MQeTextMessage
extends MQeMessage
implements javax.jms.TextMessage

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

This message type can be used to transport text-based messages, including those with XML content.

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 now be both read from and written to.

See Also:
BytesMessage, Message, MapMessage, ObjectMessage, StreamMessage

Field Summary
 
Fields inherited from class com.ibm.mqe.jms.MQeMessage
DEFAULT_DELIVERY_MODE
 
Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
 
Constructor Summary
MQeTextMessage(java.lang.String string)
          Constructs a JMS TextMessage and sets its value to the given String.
 
Method Summary
 void clearBody()
          Clear the message body and set the message to be writeable.
 java.lang.String getText()
          Get the text contained in the message body.
 void setText(java.lang.String string)
          Set the string containing this message's data.
 
Methods inherited from class com.ibm.mqe.jms.MQeMessage
acknowledge, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jms.Message
acknowledge, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
 

Constructor Detail

MQeTextMessage

public MQeTextMessage(java.lang.String string)
               throws javax.jms.JMSException
Constructs a JMS TextMessage and sets its value to the given String.

Parameters:
string - java.lang.String
Throws:
javax.jms.JMSException - if the message is not created.
Method Detail

setText

public void setText(java.lang.String string)
             throws javax.jms.JMSException
Set the string containing this message's data.

Specified by:
setText in interface javax.jms.TextMessage
Parameters:
string - the String containing the message's data
Throws:
javax.jms.JMSException - if JMS fails to set the text due to some internal JMS error.
javax.jms.MessageNotWriteableException - if message in read-only mode.

getText

public java.lang.String getText()
                         throws javax.jms.JMSException
Get the text contained in the message body. If no text has been set this will return null.

Specified by:
getText in interface javax.jms.TextMessage
Returns:
String containing the message's data.
Throws:
javax.jms.JMSException - if the attempt to get the text fails due to an internal error.

clearBody

public void clearBody()
               throws javax.jms.JMSException
Clear the message body and set the message to be writeable.

Specified by:
clearBody in interface javax.jms.Message
Specified by:
clearBody in class MQeMessage
Throws:
javax.jms.JMSException - if we fail due to an internal error

Websphere MQ Everyplace