Name
MapMessage
Synopsis
A MapMessage
has a set of name/value pairs as its message body. The
names of the properties are Strings, and the values are Java primitive
types. There are getXXX()
and setXXX()
methods for each primitive
type, plus getObject()
and setObject()
methods for situations where
the type of the value isn’t known until runtime. If a property is set
to a value of a certain type, it has to be read back using a get
method appropriate for that type, according to the following table:
if writ- | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
ten as: | boolean | byte | char | short | int | long | float | double | String | byte[] |
can be | ||||||||||
read as: | ||||||||||
boolean | X | X | ||||||||
byte | X | X | X | X | X | |||||
char | X | X | ||||||||
short | X | X | X | X | ||||||
int | X | X | X | |||||||
long | X | X | ||||||||
float | X | X | X | |||||||
double | X | X | ||||||||
String | X | X | X | X | X | X | X | X | X | |
byte[] | X |
If a value is read using an inappropriate get method, then a
MessageFormatException
is thrown. The getMapNames()
methods returns an
Enumeration
of names for the values in the MapMessage
.
Clients that receive a MapMessage
can only read the contents of the
message, until they call clearBody()
on the message. If a client tries
to write values to the message before this, a
MessageNotWriteableException
will be thrown.
public interface MapMessage extends javax.jms.Message { // Public Instance Methods public abstract boolean getBoolean( String name) throws JMSException; public abstract byte getByte( String name) throws JMSException; public ...
Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.