O'Reilly logo

Java Enterprise in a Nutshell, Second Edition by David Flanagan, Jim Farley, William Crawford

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Message

Synopsis

The Message interface is the base interface for all messages in JMS. A Message is composed of a set of predefined header fields, an optional set of application-specific properties, and a body containing the content of the message. A set and get method are provided for each header field supported by a JMS message.

Properties can be added to a message using the setXXXProperty() methods, and they can be read using the getXXXProperty() methods. If a property is written with a value of a given type, it needs to be read from the message according to the following table. If in invalid get method is used for a property, then a MessageFormatException is thrown:

if writ-        
ten as:booleanbyteshortintlongfloatdoubleString
can be         
read as:         
booleanX      X
byte XXXX  X
short  XXX  X
int   XX  X
long    X  X
float     XXX
double      XX
StringXXXXXXXX

Properties with names prefixed by “JMSX” are reserved for use by the JMS standard.

public interface Message {
// Public Constants
   public static final int DEFAULT_DELIVERY_MODE;                // =2
   public static final int DEFAULT_PRIORITY;                     // =4
   public static final long DEFAULT_TIME_TO_LIVE;                // =0
                  // Property Accessor Methods (by property name)
   public abstract String getJMSCorrelationID(
        ) throws JMSException;  
   public abstract void setJMSCorrelationID(
        String correlationID) throws JMSException;  
   public abstract byte[] getJMSCorrelationIDAsBytes(
        ) throws JMSException;  
   public abstract void setJMSCorrelationIDAsBytes(
        byte[] correlationID ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required