|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.mqe.jms.MQeMessage
The Message
interface is the root interface of all JMS messages. It
defines the JMS header and the acknowledge()
method used for
all messages.
JMS Messages are composed of the following parts:
A Message contains a built-in facility for supporting application defined property values. In effect, this provides a mechanism for adding application specific header fields to a message.
Properties allow an application, via message selectors, to have a JMS provider select/filter messages on its behalf using application-specific criteria.
Property names must obey the rules for a message selector identifier.
Property values can be boolean, byte, short, int, long, float, double, and String.
Property values are set prior to sending a message. When a client
receives a message, its properties are in read-only mode. If a
client attempts to set properties at this point, a
MessageNotWriteableException is thrown. If clearProperties()
is
called, the properties can now be both read from and written to.
Message properties support the following conversion table. The marked
cases must be supported. The unmarked cases must throw a JMSException. The
String to primitive conversions may throw a runtime exception if the
primitives valueOf()
method does not accept it as a valid
String representation of the primitive.
A value written as the row type can be read as the column type.
| | boolean byte short int long float double String |---------------------------------------------------------- |boolean | X X |byte | X X X 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 |----------------------------------------------------------
In addition to the type-specific set/get methods for properties, JMS
provides the setObjectProperty
and
getObjectProperty
methods. These support the same set of
property types using the objectified primitive values. Their purpose is
to allow the decision of property type to made at execution time rather
than at compile time. They support the same property value conversions.
The setObjectProperty
method accepts values of class
Boolean, Byte, Short, Integer, Long, Float, Double and String. An attempt
to use any other class must throw a JMSException.
The getObjectProperty
method only returns values of class
Boolean, Byte, Short, Integer, Long, Float, Double and String.
The order of property values is not defined. To iterate through a
message's property values, use getPropertyNames
to retrieve
a property name enumeration and then use the various property get methods
to retrieve their values.
A message's properties are deleted by the clearProperties
method. This leaves the message with an empty set of properties.
JMS reserves the `JMSX' property name prefix for JMS defined properties. The full set of these properties is defined in the Java Message Service specification. JMSXGroupID and JMSXGroupSeq are simply standard properties clients should use if they want to group messages. WebSphere MQ Everyplace also supports JMSXAppID, JMSXUserID, JMSXRcvTimestamp and JMSXDeliveryCount.
MQeBytesMessage
,
MQeMapMessage
,
MQeObjectMessage
,
MQeStreamMessage
,
MQeTextMessage
Field Summary | |
static int |
DEFAULT_DELIVERY_MODE
The default delivery mode value. |
Fields inherited from interface javax.jms.Message |
DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE |
Constructor Summary | |
MQeMessage()
|
Method Summary | |
void |
acknowledge()
Acknowledge this and all previous messages received. |
abstract void |
clearBody()
Clear the message body. |
void |
clearProperties()
Clear a message's properties. |
boolean |
getBooleanProperty(java.lang.String name)
Return the boolean property value with the given name. |
byte |
getByteProperty(java.lang.String name)
Return the byte property value with the given name. |
double |
getDoubleProperty(java.lang.String name)
Return the double property value with the given name. |
float |
getFloatProperty(java.lang.String name)
Return the float property value with the given name. |
int |
getIntProperty(java.lang.String name)
Return the integer property value with the given name. |
java.lang.String |
getJMSCorrelationID()
Get the correlation ID for the message. |
byte[] |
getJMSCorrelationIDAsBytes()
Get the correlation ID as an array of bytes for the message. |
int |
getJMSDeliveryMode()
Get the delivery mode for this message. |
javax.jms.Destination |
getJMSDestination()
Get the destination for this message. |
long |
getJMSExpiration()
Get the message's expiration value. |
java.lang.String |
getJMSMessageID()
Get the message ID. |
int |
getJMSPriority()
Get the message priority. |
boolean |
getJMSRedelivered()
Get an indication of whether this message is being redelivered. |
javax.jms.Destination |
getJMSReplyTo()
Get where a reply to this message should be sent. |
long |
getJMSTimestamp()
Get the message timestamp. |
java.lang.String |
getJMSType()
Get the message type. |
long |
getLongProperty(java.lang.String name)
Return the long property value with the given name. |
java.lang.Object |
getObjectProperty(java.lang.String name)
Return the Java object property value with the given name. |
java.util.Enumeration |
getPropertyNames()
Return an Enumeration of all the property names. |
short |
getShortProperty(java.lang.String name)
Return the short property value with the given name. |
java.lang.String |
getStringProperty(java.lang.String name)
Return the String property value with the given name. |
boolean |
propertyExists(java.lang.String name)
Check if a property value exists. |
void |
setBooleanProperty(java.lang.String name,
boolean value)
Set a boolean property value with the given name. |
void |
setByteProperty(java.lang.String name,
byte value)
Set a byte property value with the given name. |
void |
setDoubleProperty(java.lang.String name,
double value)
Set a double property value with the given name. |
void |
setFloatProperty(java.lang.String name,
float value)
Set a float property value with the given name. |
void |
setIntProperty(java.lang.String name,
int value)
Set an integer property value with the given name. |
void |
setJMSCorrelationID(java.lang.String correlationID)
Set the correlation ID for the message. |
void |
setJMSCorrelationIDAsBytes(byte[] correlationID)
Set the correlation ID as an array of bytes for the message. |
void |
setJMSDeliveryMode(int deliveryMode)
Set the delivery mode for this message. |
void |
setJMSDestination(javax.jms.Destination destination)
Set the destination for this message. |
void |
setJMSExpiration(long expiration)
Set the message's expiration value. |
void |
setJMSMessageID(java.lang.String id)
Set the message ID. |
void |
setJMSPriority(int priority)
Set the priority for this message. |
void |
setJMSRedelivered(boolean redelivered)
Set to indicate whether this message is being redelivered. |
void |
setJMSReplyTo(javax.jms.Destination replyTo)
Set where a reply to this message should be sent. |
void |
setJMSTimestamp(long timestamp)
Set the message timestamp. |
void |
setJMSType(java.lang.String type)
Set the message type. |
void |
setLongProperty(java.lang.String name,
long value)
Set a long property value with the given name. |
void |
setObjectProperty(java.lang.String name,
java.lang.Object value)
Set a Java object property value with the given name. |
void |
setShortProperty(java.lang.String name,
short value)
Set a short property value with the given name. |
void |
setStringProperty(java.lang.String name,
java.lang.String value)
Set a String property value with the given name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DEFAULT_DELIVERY_MODE
Constructor Detail |
public MQeMessage()
Method Detail |
public java.lang.String getJMSMessageID() throws javax.jms.JMSException
getJMSMessageID
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to get the message Id
due to internal JMS error.public void setJMSMessageID(java.lang.String id) throws javax.jms.JMSException
Any value set using this method is ignored when the message is sent, but can be used to change the value in a received message.
setJMSMessageID
in interface javax.jms.Message
id
- the ID of the message
javax.jms.JMSException
- if JMS fails to set the message Id
due to internal JMS error.public long getJMSTimestamp() throws javax.jms.JMSException
getJMSTimestamp
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to get the Timestamp
due to internal JMS error.public void setJMSTimestamp(long timestamp) throws javax.jms.JMSException
Any value set using this method is ignored when the message is sent, but can be used to change the value in a received message.
setJMSTimestamp
in interface javax.jms.Message
timestamp
- the timestamp for this message
javax.jms.JMSException
- if JMS fails to set the timestamp
due to some internal JMS error.public byte[] getJMSCorrelationIDAsBytes() throws javax.jms.JMSException
getJMSCorrelationIDAsBytes
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to get correlationId
due to some internal JMS error.public void setJMSCorrelationIDAsBytes(byte[] correlationID) throws javax.jms.JMSException
setJMSCorrelationIDAsBytes
in interface javax.jms.Message
correlationID
- the correlation ID value as an array of bytes.
javax.jms.JMSException
- if JMS fails to set correlationId
due to some internal JMS error.public void setJMSCorrelationID(java.lang.String correlationID) throws javax.jms.JMSException
A client can use the JMSCorrelationID header field to link one message with another. A typically use is to link a response message with its request message.
Note that application specified values must not start with the "ID:" prefix, which is reserved for provider generated message ID values.
setJMSCorrelationID
in interface javax.jms.Message
correlationID
- the message ID of a message being referred to.
javax.jms.JMSException
- if JMS fails to set correlationId
due to some internal JMS error.public java.lang.String getJMSCorrelationID() throws javax.jms.JMSException
getJMSCorrelationID
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to get correlationId
due to some internal JMS error.public javax.jms.Destination getJMSReplyTo() throws javax.jms.JMSException
getJMSReplyTo
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to get ReplyTo Destination
due to some internal JMS error.public void setJMSReplyTo(javax.jms.Destination replyTo) throws javax.jms.JMSException
Messages with a null replyTo value are called JMS datagrams. Datagrams may be a notification of some change in the sender (i.e. they signal a sender event) or they may just be some data the sender thinks is of interest. Messages with a replyTo value are typically expecting a response. A response may be optional, it is up to the client to decide. These messages are called JMS requests. A message sent in response to a request is called a reply.
setJMSReplyTo
in interface javax.jms.Message
replyTo
- where to send a response to this message
javax.jms.JMSException
- if JMS fails to set ReplyTo Destination
due to some internal JMS error.public javax.jms.Destination getJMSDestination() throws javax.jms.JMSException
getJMSDestination
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to get JMS Destination
due to some internal JMS error.public void setJMSDestination(javax.jms.Destination destination) throws javax.jms.JMSException
Any value set using this method is ignored when the message is sent, but this method can be used to change the value in a received message.
setJMSDestination
in interface javax.jms.Message
destination
- the destination for this message.
javax.jms.JMSException
- if JMS fails to set JMS Destination
due to some internal JMS error.public int getJMSDeliveryMode() throws javax.jms.JMSException
getJMSDeliveryMode
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to get JMS DeliveryMode
due to some internal JMS error.public void setJMSDeliveryMode(int deliveryMode) throws javax.jms.JMSException
Any value set using this method is ignored when the message is sent, but this method can be used to change the value in a received message.
setJMSDeliveryMode
in interface javax.jms.Message
deliveryMode
- the delivery mode for this message.
javax.jms.JMSException
- if JMS fails to set JMS DeliveryMode
due to some internal JMS error.public boolean getJMSRedelivered() throws javax.jms.JMSException
If a client receives a message with the redelivered indicator set, it is likely, but not guaranteed, that this message was delivered to the client earlier but the client did not acknowledge its receipt at that earlier time.
getJMSRedelivered
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to get JMS Redelivered flag
due to some internal JMS error.public void setJMSRedelivered(boolean redelivered) throws javax.jms.JMSException
Any value set using this method is ignored when the message is sent, but this method can be used to change the value in a received message.
setJMSRedelivered
in interface javax.jms.Message
redelivered
- an indication of whether this message is being
redelivered.
javax.jms.JMSException
- if JMS fails to set JMS Redelivered flag
due to some internal JMS error.public java.lang.String getJMSType() throws javax.jms.JMSException
getJMSType
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to get JMS message type
due to some internal JMS error.public void setJMSType(java.lang.String type) throws javax.jms.JMSException
JMS clients should assign a value to type whether the application makes use of it or not. This insures that it is properly set for those providers that require it.
setJMSType
in interface javax.jms.Message
type
- the class of message
javax.jms.JMSException
- if JMS fails to set JMS message type
due to some internal JMS error.public long getJMSExpiration() throws javax.jms.JMSException
If the time-to-live is specified as zero, expiration is set to zero which indicates the message does not expire.
getJMSExpiration
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to get JMS message expiration
due to some internal JMS error.public void setJMSExpiration(long expiration) throws javax.jms.JMSException
Any value set using this method is ignored when the message is sent, but this method can be used to change the value in a received message.
setJMSExpiration
in interface javax.jms.Message
expiration
- the message's expiration time
javax.jms.JMSException
- if JMS fails to set JMS message expiration
due to some internal JMS error.public int getJMSPriority() throws javax.jms.JMSException
JMS defines a ten level priority value with 0 as the lowest priority and 9 as the highest. In addition, clients should consider priorities 0-4 as gradations of normal priority and priorities 5-9 as gradations of expedited priority.
getJMSPriority
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to get JMS message priority
due to some internal JMS error.public void setJMSPriority(int priority) throws javax.jms.JMSException
Any value set using this method is ignored when the message is sent, but this method can be used to change the value in a received message.
setJMSPriority
in interface javax.jms.Message
priority
- the priority of this message
javax.jms.JMSException
- if JMS fails to set JMS message priority
due to some internal JMS error.public void clearProperties() throws javax.jms.JMSException
clearProperties
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to clear JMS message
properties due to some internal JMS
error.public boolean propertyExists(java.lang.String name) throws javax.jms.JMSException
propertyExists
in interface javax.jms.Message
name
- the name of the property to test
javax.jms.JMSException
- if JMS fails to check if property
exists due to some internal JMS
error.public boolean getBooleanProperty(java.lang.String name) throws javax.jms.JMSException
getBooleanProperty
in interface javax.jms.Message
name
- the name of the boolean property
javax.jms.JMSException
- if JMS fails to get Property due to
some internal JMS error.
javax.jms.MessageFormatException
- if this type conversion is invalid.public byte getByteProperty(java.lang.String name) throws javax.jms.JMSException, java.lang.NumberFormatException
getByteProperty
in interface javax.jms.Message
name
- the name of the byte property
javax.jms.JMSException
- if JMS fails to get Property due to
some internal JMS error.
javax.jms.MessageFormatException
- if this type conversion is invalid.
java.lang.NumberFormatException
public short getShortProperty(java.lang.String name) throws javax.jms.JMSException, java.lang.NumberFormatException
getShortProperty
in interface javax.jms.Message
name
- the name of the short property
javax.jms.JMSException
- if JMS fails to get Property due to
some internal JMS error.
javax.jms.MessageFormatException
- if this type conversion is invalid.
java.lang.NumberFormatException
public int getIntProperty(java.lang.String name) throws javax.jms.JMSException, java.lang.NumberFormatException
getIntProperty
in interface javax.jms.Message
name
- the name of the integer property
javax.jms.JMSException
- if JMS fails to get Property due to
some internal JMS error.
javax.jms.MessageFormatException
- if this type conversion is invalid.
java.lang.NumberFormatException
public long getLongProperty(java.lang.String name) throws javax.jms.JMSException, java.lang.NumberFormatException
getLongProperty
in interface javax.jms.Message
name
- the name of the long property
javax.jms.JMSException
- if JMS fails to get Property due to
some internal JMS error.
javax.jms.MessageFormatException
- if this type conversion is invalid.
java.lang.NumberFormatException
public float getFloatProperty(java.lang.String name) throws javax.jms.JMSException, java.lang.NullPointerException
getFloatProperty
in interface javax.jms.Message
name
- the name of the float property
javax.jms.JMSException
- if JMS fails to get Property due to
some internal JMS error.
javax.jms.MessageFormatException
- if this type conversion is invalid.
java.lang.NullPointerException
public double getDoubleProperty(java.lang.String name) throws javax.jms.JMSException, java.lang.NullPointerException
getDoubleProperty
in interface javax.jms.Message
name
- the name of the double property
javax.jms.JMSException
- if JMS fails to get Property due to
some internal JMS error.
javax.jms.MessageFormatException
- if this type conversion is invalid.
java.lang.NullPointerException
public java.lang.String getStringProperty(java.lang.String name) throws javax.jms.JMSException
getStringProperty
in interface javax.jms.Message
name
- the name of the String property
javax.jms.JMSException
- if JMS fails to get Property due to
some internal JMS error.
javax.jms.MessageFormatException
- if this type conversion is invalid.public java.lang.Object getObjectProperty(java.lang.String name) throws javax.jms.JMSException
Note that this method can be used to return in objectified format,
an object that had been stored as a property in the Message with the
equivalent
setObject
method call, or it's equivalent
primitive set
getObjectProperty
in interface javax.jms.Message
name
- the name of the Java object property
javax.jms.JMSException
- if JMS fails to get Property due to
some internal JMS error.
public java.util.Enumeration getPropertyNames() throws javax.jms.JMSException
getPropertyNames
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to get Property names due to
some internal JMS error.public void setBooleanProperty(java.lang.String name, boolean value) throws javax.jms.JMSException
setBooleanProperty
in interface javax.jms.Message
name
- the name of the boolean propertyvalue
- the boolean property value to set in the Message.
javax.jms.JMSException
- if JMS fails to set Property due to
some internal JMS error.
javax.jms.MessageNotWriteableException
- if properties are read-onlypublic void setByteProperty(java.lang.String name, byte value) throws javax.jms.JMSException
setByteProperty
in interface javax.jms.Message
name
- the name of the byte propertyvalue
- the byte property value to set in the Message.
javax.jms.JMSException
- if JMS fails to set Property due to
some internal JMS error.
javax.jms.MessageNotWriteableException
- if properties are read-onlypublic void setShortProperty(java.lang.String name, short value) throws javax.jms.JMSException
setShortProperty
in interface javax.jms.Message
name
- the name of the short propertyvalue
- the short property value to set in the Message.
javax.jms.JMSException
- if JMS fails to set Property due to
some internal JMS error.
javax.jms.MessageNotWriteableException
- if properties are read-onlypublic void setIntProperty(java.lang.String name, int value) throws javax.jms.JMSException
setIntProperty
in interface javax.jms.Message
name
- the name of the integer propertyvalue
- the integer property value to set in the Message.
javax.jms.JMSException
- if JMS fails to set Property due to
some internal JMS error.
javax.jms.MessageNotWriteableException
- if properties are read-onlypublic void setLongProperty(java.lang.String name, long value) throws javax.jms.JMSException
setLongProperty
in interface javax.jms.Message
name
- the name of the long propertyvalue
- the long property value to set in the Message.
javax.jms.JMSException
- if JMS fails to set Property due to
some internal JMS error.
javax.jms.MessageNotWriteableException
- if properties are read-onlypublic void setFloatProperty(java.lang.String name, float value) throws javax.jms.JMSException
setFloatProperty
in interface javax.jms.Message
name
- the name of the float propertyvalue
- the float property value to set in the Message.
javax.jms.JMSException
- if JMS fails to set Property due to
some internal JMS error.
javax.jms.MessageNotWriteableException
- if properties are read-onlypublic void setDoubleProperty(java.lang.String name, double value) throws javax.jms.JMSException
setDoubleProperty
in interface javax.jms.Message
name
- the name of the double propertyvalue
- the double property value to set in the Message.
javax.jms.JMSException
- if JMS fails to set Property due to
some internal JMS error.
javax.jms.MessageNotWriteableException
- if properties are read-onlypublic void setStringProperty(java.lang.String name, java.lang.String value) throws javax.jms.JMSException
setStringProperty
in interface javax.jms.Message
name
- the name of the String propertyvalue
- the String property value to set in the Message.
javax.jms.JMSException
- if JMS fails to set Property due to
some internal JMS error.
javax.jms.MessageNotWriteableException
- if properties are read-onlypublic void setObjectProperty(java.lang.String name, java.lang.Object value) throws javax.jms.JMSException
Note that this method only works for the objectified primitive object types (Integer, Double, Long ...) and String's.
setObjectProperty
in interface javax.jms.Message
name
- the name of the Java object property.value
- the Java object property value to set in the Message.
javax.jms.JMSException
- if JMS fails to set Property due to
some internal JMS error.
javax.jms.MessageFormatException
- if object is invalid
javax.jms.MessageNotWriteableException
- if properties are read-onlypublic void acknowledge() throws javax.jms.JMSException
All JMS messages support the acknowledge() method for use when a client has specified that a JMS consumers messages are to be explicitly acknowledged. JMS defaults to implicit message acknowledgement. In this mode, calls to acknowledge() are ignored.
acknowledge
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to acknowledge due to some
internal JMS error.public abstract void clearBody() throws javax.jms.JMSException
clearBody
in interface javax.jms.Message
javax.jms.JMSException
- if JMS fails to due to some internal JMS error.
|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |