Class PulsarStreamMessage
- All Implemented Interfaces:
javax.jms.Message,javax.jms.StreamMessage
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DataInputStreamprotected DataOutputStreamprotected byte[]protected intprotected ByteArrayOutputStreamprotected static final byteprotected static final byteprotected static final byteprotected static final byteprotected static final byteprotected static final byteprotected static final byteprotected static final byteprotected static final byteprotected static final byteprotected static final byteFields inherited from class com.datastax.oss.pulsar.jms.PulsarMessage
properties, writableFields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_DELAY, DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckType(byte type, byte expected) voidClears out the message body.<T> TlongGets the number of bytes of the message body when the message is in read-only mode.booleanReturns whether the message body is capable of being assigned to the specified type.protected Stringprotected voidprepareForSend(org.apache.pulsar.client.api.TypedMessageBuilder<byte[]> producer) protected intbooleanReads abooleanfrom the stream message.bytereadByte()Reads abytevalue from the stream message.intreadBytes(byte[] value) Reads a byte array field from the stream message into the specifiedbyte[]object (the read buffer).intreadBytes(byte[] value, int length) Reads a portion of the bytes message stream.charreadChar()Reads a Unicode character value from the stream message.protected bytedoubleReads adoublefrom the stream message.floatReads afloatfrom the stream message.intreadInt()Reads a 32-bit integer from the stream message.longreadLong()Reads a 64-bit integer from the stream message.Reads an object from the stream message.shortReads a 16-bit integer from the stream message.Reads aStringfrom the stream message.intReads an unsigned 8-bit number from the bytes message stream.intReads an unsigned 16-bit number from the bytes message stream.readUTF()Reads a string that has been encoded using a modified UTF-8 format from the bytes message stream.voidreset()Puts the message body in read-only mode and repositions the stream to the beginning.protected voidwriteArrayLen(int len) voidwriteBoolean(boolean value) Writes abooleanto the stream message.voidwriteByte(byte value) Writes abyteto the stream message.voidwriteBytes(byte[] value) Writes a byte array field to the stream message.voidwriteBytes(byte[] value, int offset, int length) Writes a portion of a byte array as a byte array field to the stream message.voidwriteChar(char value) Writes acharto the stream message.protected voidwriteDataType(byte dataType) voidwriteDouble(double value) Writes adoubleto the stream message.voidwriteFloat(float value) Writes afloatto the stream message.voidwriteInt(int value) Writes anintto the stream message.voidwriteLong(long value) Writes alongto the stream message.voidwriteObject(Object value) Writes an object to the stream message.voidwriteShort(short value) Writes ashortto the stream message.voidwriteString(String value) Writes aStringto the stream message.voidWrites a string to the bytes message stream using UTF-8 encoding in a machine-independent manner.Methods inherited from class com.datastax.oss.pulsar.jms.PulsarMessage
acknowledge, acknowledgeInternalInTransaction, applyMessage, checkReadable, checkWritable, checkWritableProperty, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDeliveryTime, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getReceivedPulsarMessage, getShortProperty, getStringProperty, handleExceptionAccordingToMessageSpecs, isReceivedFromConsumer, negativeAck, propertyExists, readJMSPriority, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty, setWritable, validateWritableObjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.jms.Message
acknowledge, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDeliveryTime, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
-
Field Details
-
stream
-
originalMessage
protected byte[] originalMessage -
dataInputStream
-
dataOutputStream
-
remainingByteArrayLen
protected int remainingByteArrayLen -
TYPE_BOOLEAN
protected static final byte TYPE_BOOLEAN- See Also:
-
TYPE_STRING
protected static final byte TYPE_STRING- See Also:
-
TYPE_INT
protected static final byte TYPE_INT- See Also:
-
TYPE_SHORT
protected static final byte TYPE_SHORT- See Also:
-
TYPE_LONG
protected static final byte TYPE_LONG- See Also:
-
TYPE_FLOAT
protected static final byte TYPE_FLOAT- See Also:
-
TYPE_DOUBLE
protected static final byte TYPE_DOUBLE- See Also:
-
TYPE_BYTE
protected static final byte TYPE_BYTE- See Also:
-
TYPE_CHAR
protected static final byte TYPE_CHAR- See Also:
-
TYPE_BYTES
protected static final byte TYPE_BYTES- See Also:
-
TYPE_NULL
protected static final byte TYPE_NULL- See Also:
-
-
Constructor Details
-
PulsarStreamMessage
public PulsarStreamMessage(byte[] payload) throws javax.jms.JMSException - Throws:
javax.jms.JMSException
-
PulsarStreamMessage
public PulsarStreamMessage()
-
-
Method Details
-
messageType
- Specified by:
messageTypein classPulsarMessage
-
checkType
protected void checkType(byte type, byte expected) throws javax.jms.JMSException - Throws:
javax.jms.JMSException
-
getBody
- Specified by:
getBodyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
writeDataType
- Throws:
IOException
-
writeArrayLen
- Throws:
IOException
-
readArrayLen
- Throws:
IOException
-
readDataType
- Throws:
IOException
-
readBytes
public int readBytes(byte[] value) throws javax.jms.JMSException Reads a byte array field from the stream message into the specifiedbyte[]object (the read buffer).To read the field value,
readBytesshould be successively called until it returns a value less than the length of the read buffer. The value of the bytes in the buffer following the last byte read is undefined.If
readBytesreturns a value equal to the length of the buffer, a subsequentreadBytescall must be made. If there are no more bytes to be read, this call returns -1.If the byte array field value is null,
readBytesreturns -1.If the byte array field value is empty,
readBytesreturns 0.Once the first
readBytescall on abyte[]field value has been made, the full value of the field must be read before it is valid to read the next field. An attempt to read the next field before that has been done will throw aMessageFormatException.To read the byte field value into a new
byte[]object, use thereadObjectmethod.- Specified by:
readBytesin interfacejavax.jms.StreamMessage- Parameters:
value- the buffer into which the data is read- Returns:
- the total number of bytes read into the buffer, or -1 if there is no more data because the end of the byte field has been reached
- Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageEOFException- if unexpected end of message stream has been reached.javax.jms.MessageFormatException- if this type conversion is invalid.javax.jms.MessageNotReadableException- if the message is in write-only mode.- See Also:
-
readObject
Reads an object from the stream message.This method can be used to return, in objectified format, an object in the Java programming language ("Java object") that has been written to the stream with the equivalent
writeObjectmethod call, or its equivalent primitivewritetypemethod.Note that byte values are returned as
byte[], notByte[].An attempt to call
readObjectto read a byte field value into a newbyte[]object before the full value of the byte field has been read will throw aMessageFormatException.- Specified by:
readObjectin interfacejavax.jms.StreamMessage- Returns:
- a Java object from the stream message, in objectified format (for example, if the
object was written as an
int, anIntegeris returned) - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageEOFException- if unexpected end of message stream has been reached.javax.jms.MessageFormatException- if this type conversion is invalid.javax.jms.MessageNotReadableException- if the message is in write-only mode.- See Also:
-
isBodyAssignableTo
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 methodgetBodyon the same message with the same type argument would not throw a MessageFormatException.If the message is a
StreamMessagethen false is always returned. If the message is aObjectMessageand 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:
isBodyAssignableToin interfacejavax.jms.Message- Parameters:
c- The specified type
If the message is aTextMessagethen this method will only return true if this parameter is set toString.classor another type to which aStringis assignable.
If the message is aObjectMessagethen this method will only return true if this parameter is set tojava.io.Serializable.classor another class to which the body is assignable.
If the message is aMapMessagethen this method will only return true if this parameter is set tojava.util.Map.class(orjava.lang.Object.class).
If the message is aBytesMessagethen this this method will only return true if this parameter is set tobyte[].class(orjava.lang.Object.class).
If the message is aTextMessage,ObjectMessage,MapMessageorBytesMessageand 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 aMessage(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
- Throws:
javax.jms.JMSException- if the JMS provider fails to return a value due to some internal error.
-
prepareForSend
protected void prepareForSend(org.apache.pulsar.client.api.TypedMessageBuilder<byte[]> producer) throws javax.jms.JMSException - Specified by:
prepareForSendin classPulsarMessage- Throws:
javax.jms.JMSException
-
readBoolean
public boolean readBoolean() throws javax.jms.JMSExceptionReads abooleanfrom the stream message.- Specified by:
readBooleanin interfacejavax.jms.StreamMessage- Returns:
- the
booleanvalue read - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageEOFException- if unexpected end of message stream has been reached.javax.jms.MessageFormatException- if this type conversion is invalid.javax.jms.MessageNotReadableException- if the message is in write-only mode.
-
readByte
public byte readByte() throws javax.jms.JMSExceptionReads abytevalue from the stream message.- Specified by:
readBytein interfacejavax.jms.StreamMessage- Returns:
- the next byte from the stream message as a 8-bit
byte - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageEOFException- if unexpected end of message stream has been reached.javax.jms.MessageFormatException- if this type conversion is invalid.javax.jms.MessageNotReadableException- if the message is in write-only mode.
-
readShort
public short readShort() throws javax.jms.JMSExceptionReads a 16-bit integer from the stream message.- Specified by:
readShortin interfacejavax.jms.StreamMessage- Returns:
- a 16-bit integer from the stream message
- Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageEOFException- if unexpected end of message stream has been reached.javax.jms.MessageFormatException- if this type conversion is invalid.javax.jms.MessageNotReadableException- if the message is in write-only mode.
-
readChar
public char readChar() throws javax.jms.JMSExceptionReads a Unicode character value from the stream message.- Specified by:
readCharin interfacejavax.jms.StreamMessage- Returns:
- a Unicode character from the stream message
- Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageEOFException- if unexpected end of message stream has been reached.javax.jms.MessageFormatException- if this type conversion is invalidjavax.jms.MessageNotReadableException- if the message is in write-only mode.
-
readInt
public int readInt() throws javax.jms.JMSExceptionReads a 32-bit integer from the stream message.- Specified by:
readIntin interfacejavax.jms.StreamMessage- Returns:
- a 32-bit integer value from the stream message, interpreted as an
int - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageEOFException- if unexpected end of message stream has been reached.javax.jms.MessageFormatException- if this type conversion is invalid.javax.jms.MessageNotReadableException- if the message is in write-only mode.
-
readLong
public long readLong() throws javax.jms.JMSExceptionReads a 64-bit integer from the stream message.- Specified by:
readLongin interfacejavax.jms.StreamMessage- Returns:
- a 64-bit integer value from the stream message, interpreted as a
long - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageEOFException- if unexpected end of message stream has been reached.javax.jms.MessageFormatException- if this type conversion is invalid.javax.jms.MessageNotReadableException- if the message is in write-only mode.
-
readFloat
public float readFloat() throws javax.jms.JMSExceptionReads afloatfrom the stream message.- Specified by:
readFloatin interfacejavax.jms.StreamMessage- Returns:
- a
floatvalue from the stream message - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageEOFException- if unexpected end of message stream has been reached.javax.jms.MessageFormatException- if this type conversion is invalid.javax.jms.MessageNotReadableException- if the message is in write-only mode.
-
readDouble
public double readDouble() throws javax.jms.JMSExceptionReads adoublefrom the stream message.- Specified by:
readDoublein interfacejavax.jms.StreamMessage- Returns:
- a
doublevalue from the stream message - Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageEOFException- if unexpected end of message stream has been reached.javax.jms.MessageFormatException- if this type conversion is invalid.javax.jms.MessageNotReadableException- if the message is in write-only mode.
-
readString
Reads aStringfrom the stream message.- Specified by:
readStringin interfacejavax.jms.StreamMessage- Returns:
- a Unicode string from the stream message
- Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageEOFException- if unexpected end of message stream has been reached.javax.jms.MessageFormatException- if this type conversion is invalid.javax.jms.MessageNotReadableException- if the message is in write-only mode.
-
writeBoolean
public void writeBoolean(boolean value) throws javax.jms.JMSException Writes abooleanto the stream message. The valuetrueis written as the value(byte)1; the valuefalseis written as the value(byte)0.- Specified by:
writeBooleanin interfacejavax.jms.StreamMessage- Parameters:
value- thebooleanvalue to be written- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
writeByte
public void writeByte(byte value) throws javax.jms.JMSException Writes abyteto the stream message.- Specified by:
writeBytein interfacejavax.jms.StreamMessage- Parameters:
value- thebytevalue to be written- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
writeShort
public void writeShort(short value) throws javax.jms.JMSException Writes ashortto the stream message.- Specified by:
writeShortin interfacejavax.jms.StreamMessage- Parameters:
value- theshortvalue to be written- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
writeChar
public void writeChar(char value) throws javax.jms.JMSException Writes acharto the stream message.- Specified by:
writeCharin interfacejavax.jms.StreamMessage- Parameters:
value- thecharvalue to be written- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
writeInt
public void writeInt(int value) throws javax.jms.JMSException Writes anintto the stream message.- Specified by:
writeIntin interfacejavax.jms.StreamMessage- Parameters:
value- theintvalue to be written- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
writeLong
public void writeLong(long value) throws javax.jms.JMSException Writes alongto the stream message.- Specified by:
writeLongin interfacejavax.jms.StreamMessage- Parameters:
value- thelongvalue to be written- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
writeFloat
public void writeFloat(float value) throws javax.jms.JMSException Writes afloatto the stream message.- Specified by:
writeFloatin interfacejavax.jms.StreamMessage- Parameters:
value- thefloatvalue to be written- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
writeDouble
public void writeDouble(double value) throws javax.jms.JMSException Writes adoubleto the stream message.- Specified by:
writeDoublein interfacejavax.jms.StreamMessage- Parameters:
value- thedoublevalue to be written- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
writeString
Writes aStringto the stream message.- Specified by:
writeStringin interfacejavax.jms.StreamMessage- Parameters:
value- theStringvalue to be written- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
writeBytes
public void writeBytes(byte[] value) throws javax.jms.JMSException Writes a byte array field to the stream message.The byte array
valueis written to the message as a byte array field. Consecutively written byte array fields are treated as two distinct fields when the fields are read.- Specified by:
writeBytesin interfacejavax.jms.StreamMessage- Parameters:
value- the byte array value to be written- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
writeBytes
public void writeBytes(byte[] value, int offset, int length) throws javax.jms.JMSException Writes a portion of a byte array as a byte array field to the stream message.The a portion of the byte array
valueis written to the message as a byte array field. Consecutively written byte array fields are treated as two distinct fields when the fields are read.- Specified by:
writeBytesin interfacejavax.jms.StreamMessage- Parameters:
value- the byte array value to be writtenoffset- the initial offset within the byte arraylength- the number of bytes to use- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
writeObject
Writes an object to the stream message.This method works only for the objectified primitive object types (
Integer,Double,Long...),Stringobjects, and byte arrays.- Specified by:
writeObjectin interfacejavax.jms.StreamMessage- Parameters:
value- the Java object to be written- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.javax.jms.MessageFormatException- if the object is invalid.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-
clearBody
public void clearBody() throws javax.jms.JMSExceptionClears 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:
clearBodyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException- if the JMS provider fails to clear the message body due to some internal error.
-
reset
public void reset() throws javax.jms.JMSExceptionPuts the message body in read-only mode and repositions the stream to the beginning.- Specified by:
resetin interfacejavax.jms.StreamMessage- Throws:
javax.jms.JMSException- if the JMS provider fails to reset the message due to some internal error.javax.jms.MessageFormatException- if the message has an invalid format.
-
getBodyLength
public long getBodyLength() throws javax.jms.JMSExceptionGets the number of bytes of the message body when the message is in read-only mode. The value returned can be used to allocate a byte array. The value returned is the entire length of the message body, regardless of where the pointer for reading the message is currently located.- Returns:
- number of bytes in the message
- Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageNotReadableException- if the message is in write-only mode.- Since:
- JMS 1.1
-
readUnsignedByte
public int readUnsignedByte() throws javax.jms.JMSExceptionReads an unsigned 8-bit number from the bytes message stream.- Returns:
- the next byte from the bytes message stream, interpreted as an unsigned 8-bit number
- Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageEOFException- if unexpected end of bytes stream has been reached.javax.jms.MessageNotReadableException- if the message is in write-only mode.
-
readUnsignedShort
public int readUnsignedShort() throws javax.jms.JMSExceptionReads an unsigned 16-bit number from the bytes message stream.- Returns:
- the next two bytes from the bytes message stream, interpreted as an unsigned 16-bit integer
- Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageEOFException- if unexpected end of bytes stream has been reached.javax.jms.MessageNotReadableException- if the message is in write-only mode.
-
readUTF
Reads a string that has been encoded using a modified UTF-8 format from the bytes message stream.For more information on the UTF-8 format, see "File System Safe UCS Transformation Format (FSS_UTF)", X/Open Preliminary Specification, X/Open Company Ltd., Document Number: P316. This information also appears in ISO/IEC 10646, Annex P.
- Returns:
- a Unicode string from the bytes message stream
- Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageEOFException- if unexpected end of bytes stream has been reached.javax.jms.MessageNotReadableException- if the message is in write-only mode.
-
readBytes
public int readBytes(byte[] value, int length) throws javax.jms.JMSException Reads a portion of the bytes message stream.If the length of array
valueis less than the number of bytes remaining to be read from the stream, the array should be filled. A subsequent call reads the next increment, and so on.If the number of bytes remaining in the stream is less than the length of array
value, the bytes should be read into the array. The return value of the total number of bytes read will be less than the length of the array, indicating that there are no more bytes left to be read from the stream. The next read of the stream returns -1.If
lengthis negative, orlengthis greater than the length of the arrayvalue, then anIndexOutOfBoundsExceptionis thrown. No bytes will be read from the stream for this exception case.- Parameters:
value- the buffer into which the data is readlength- the number of bytes to read; must be less than or equal tovalue.length- Returns:
- the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached
- Throws:
javax.jms.JMSException- if the JMS provider fails to read the message due to some internal error.javax.jms.MessageNotReadableException- if the message is in write-only mode.
-
writeUTF
Writes a string to the bytes message stream using UTF-8 encoding in a machine-independent manner.For more information on the UTF-8 format, see "File System Safe UCS Transformation Format (FSS_UTF)", X/Open Preliminary Specification, X/Open Company Ltd., Document Number: P316. This information also appears in ISO/IEC 10646, Annex P.
- Parameters:
value- theStringvalue to be written- Throws:
javax.jms.JMSException- if the JMS provider fails to write the message due to some internal error.javax.jms.MessageNotWriteableException- if the message is in read-only mode.
-