The Message interface is the root interface of all JMS messages. It
defines the JMS header and the acknowledge method used for all
messages.
- acknowledge
-
public void acknowledge() throws JMSException
Acknowledge this and all previous messages received by the session.
- Throws:
- JMSException - if JMS fails to acknowledge because of an internal JMS
error.
- clearBody
-
public void clearBody() throws JMSException
Clear out the message body. All other parts of the message are left
untouched.
- Throws:
- JMSException - if JMS fails to because of an internal JMS error.
- clearProperties
-
public void clearProperties() throws JMSException
Clear a message's properties. The header fields and message
body are not cleared.
- Throws:
- JMSException - if JMS fails to clear JMS message properties because of an
internal JMS error.
- getBooleanProperty
-
public boolean getBooleanProperty(java.lang.String name)
throws JMSException
Return the boolean property value with the given name.
- Parameters:
- name - the name of the boolean property.
- Returns:
- the boolean property value with the given name.
- Throws:
-
- JMSException - if JMS fails to get the property because of an internal JMS
error.
- MessageFormatException - if this type conversion is not valid
- getByteProperty
-
public byte getByteProperty(java.lang.String name)
throws JMSException
Return the byte property value with the given name.
- Parameters:
- name - the name of the byte property.
- Returns:
- the byte property value with the given name.
- Throws:
-
- JMSException - if JMS fails to get the property because of an internal JMS
error.
- MessageFormatException - if this type conversion is not valid.
- getDoubleProperty
-
public double getDoubleProperty(java.lang.String name)
throws JMSException
Return the double property value with the given name.
- Parameters:
- name - the name of the double property.
- Returns:
- the double property value with the given name.
- Throws:
-
- JMSException - if JMS fails to get the property because of an internal JMS
error.
- MessageFormatException - if this type conversion is not valid.
- getFloatProperty
-
public float getFloatProperty(java.lang.String name)
throws JMSException
Return the float property value with the given name.
- Parameters:
- name - the name of the float property.
- Returns:
- the float property value with the given name.
- Throws:
-
- JMSException - if JMS fails to get the property because of an internal JMS
error.
- MessageFormatException - if this type conversion is not valid.
- getIntProperty
-
public int getIntProperty(java.lang.String name)
throws JMSException
Return the integer property value with the given name.
- Parameters:
- name - the name of the integer property.
- Returns:
- the integer property value with the given name.
- Throws:
-
- JMSException - if JMS fails to get the property because of an internal JMS
error.
- MessageFormatException - if this type conversion is not valid.
- getJMSCorrelationID
-
public java.lang.String getJMSCorrelationID()
throws JMSException
Get the correlation ID for the message.
- Returns:
- the correlation ID of a message as a String.
- Throws:
- JMSException - if JMS fails to get the correlation ID because of an
internal JMS error.
- See also:
- setJMSCorrelationID(), getJMSCorrelationIDAsBytes(),
setJMSCorrelationIDAsBytes()
- getJMSCorrelationIDAsBytes
-
public byte[] getJMSCorrelationIDAsBytes()
throws JMSException
Get the correlation ID as an array of bytes for the message.
- Returns:
- the correlation ID of a message as an array of bytes.
- Throws:
- JMSException - if JMS fails to get correlation ID because of an internal
JMS error.
- See also:
- setJMSCorrelationID(), getJMSCorrelationID(), setJMSCorrelationIDAsBytes()
- getJMSDeliveryMode
-
public int getJMSDeliveryMode() throws JMSException
Get the delivery mode for this message.
- Returns:
- the delivery mode of this message.
- Throws:
- JMSException - if JMS fails to get JMS DeliveryMode because of an internal
JMS error.
- See also:
- setJMSDeliveryMode(), DeliveryMode
- getJMSDestination
-
public Destination getJMSDestination() throws JMSException
Get the destination for this message.
- Returns:
- the destination of this message.
- Throws:
- JMSException - if JMS fails to get JMS Destination because of an internal
JMS error.
- See also:
- setJMSDestination()
- getJMSExpiration
-
public long getJMSExpiration() throws JMSException
Get the message's expiration value.
- Returns:
- the time the message expires. It is the sum of the time-to-live
value specified by the client, and the GMT at the time of the send.
- Throws:
- JMSException - if JMS fails to get JMS message expiration because of an
internal JMS error.
- See also:
- setJMSExpiration()
- getJMSMessageID
-
public java.lang.String getJMSMessageID()
throws JMSException
Get the message ID.
- Returns:
- the message ID.
- Throws:
- JMSException - if JMS fails to get the message ID because of an internal
JMS error.
- See also:
- setJMSMessageID()
- getJMSPriority
-
public int getJMSPriority() throws JMSException
Get the message priority.
- Returns:
- the message priority.
- Throws:
- JMSException - if JMS fails to get JMS message priority because of an
internal JMS error.
- See also:
- setJMSPriority() for priority levels
- getJMSRedelivered
-
public boolean getJMSRedelivered() throws JMSException
Get an indication of whether this message is being redelivered.
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.
- Returns:
- set to true if this message is being redelivered.
- Throws:
- JMSException - if JMS fails to get JMS Redelivered flag because of an
internal JMS error.
- See also:
- setJMSRedelivered()
- getJMSReplyTo
-
public Destination getJMSReplyTo() throws JMSException
Get where a reply to this message should be sent.
- Returns:
- where to send a response to this message
- Throws:
- JMSException - if JMS fails to get ReplyTo Destination because of an
internal JMS error.
- See also:
- setJMSReplyTo()
- getJMSTimestamp
-
public long getJMSTimestamp() throws JMSException
Get the message timestamp.
- Returns:
- the message timestamp.
- Throws:
- JMSException - if JMS fails to get the Timestamp because of an internal
JMS error.
- See also:
- setJMSTimestamp()
- getJMSType
-
public java.lang.String getJMSType() throws JMSException
Get the message type.
- Returns:
- the message type.
- Throws:
- JMSException - if JMS fails to get JMS message type because of an internal
JMS error.
- See also:
- setJMSType()
- getLongProperty
-
public long getLongProperty(java.lang.String name)
throws JMSException
Return the long property value with the given name.
- Parameters:
- name - the name of the long property.
- Returns:
- the long property value with the given name.
- Throws:
-
- JMSException - if JMS fails to get the property because of an internal JMS
error.
- MessageFormatException - if this type conversion is not valid.
- getObjectProperty
-
public java.lang.Object getObjectProperty (java.lang.String name)
throws JMSException
Return the Java object property value with the given name.
- Parameters:
- name - the name of the Java object property.
- Returns:
- the Java object property value with the given name, in object format (for
example, if it set as an int, an Integer is returned). If there is no
property by this name, a null value is returned.
- Throws:
- JMSException - if JMS fails to get the property because of an internal JMS
error.
- getPropertyNames
-
public java.util.Enumeration getPropertyNames()
throws JMSException
Return an Enumeration of all the property names.
- Returns:
- an enumeration of all the names of property values.
- Throws:
- JMSException - if JMS fails to get the property names because of an
internal JMS error.
- getShortProperty
-
public short getShortProperty(java.lang.String name)
throws JMSException
Return the short property value with the given name.
- Parameters:
- name - the name of the short property.
- Returns:
- the short property value with the given name.
- Throws:
-
- JMSException - if JMS fails to get the property because of an internal JMS
error.
- MessageFormatException - if this type conversion is not valid.
- getStringProperty
-
public java.lang.String getStringProperty (java.lang.String name)
throws JMSException
Return the String property value with the given name.
- Parameters:
- name - the name of the String property
- Returns:
- the String property value with the given name. If there is no
property by this name, a null value is returned.
- Throws:
-
- JMSException - if JMS fails to get the property because of an internal JMS
error.
- MessageFormatException - if this type conversion is not valid.
- propertyExists
-
public boolean propertyExists(java.lang.String name)
throws JMSException
Check if a property value exists.
- Parameters:
- name - the name of the property to test.
- Returns:
- true if the property does exist.
- Throws:
- JMSException - if JMS fails to check whether a property exists because of
an internal JMS error.
- setBooleanProperty
-
public void setBooleanProperty(java.lang.String name,
boolean value) throws JMSException
Set a boolean property value with the given name into the Message.
- Parameters:
-
- name - the name of the boolean property.
- value - the boolean property value to set in the Message.
- Throws:
-
- JMSException - if JMS fails to set Property because of an internal JMS
error.
- MessageNotWriteableException - if the properties are read-only.
- setByteProperty
-
public void setByteProperty(java.lang.String name,
byte value) throws JMSException
Set a byte property value with the given name into the Message.
- Parameters:
-
- name - the name of the byte property.
- value - the byte property value to set in the Message.
- Throws:
-
- JMSException - if JMS fails to set Property because of an internal JMS
error.
- MessageNotWriteableException - if the properties are read-only.
- setDoubleProperty
-
public void setDoubleProperty(java.lang.String name,
double value) throws JMSException
Set a double property value with the given name into the Message.
- Parameters:
-
- name - the name of the double property.
- value - the double property value to set in the Message.
- Throws:
-
- JMSException - if JMS fails to set the property because of an internal JMS
error.
- MessageNotWriteableException - if the properties are read-only.
- setFloatProperty
-
public void setFloatProperty(java.lang.String name,
float value) throws JMSException
Set a float property value with the given name into the Message.
- Parameters:
-
- name - the name of the float property.
- value - the float property value to set in the Message.
- Throws:
-
- JMSException - if JMS fails to set the property because of an internal JMS
error.
- MessageNotWriteableException - if the properties are read-only.
- setIntProperty
-
public void setIntProperty(java.lang.String name,
int value) throws JMSException
Set an integer property value with the given name into the Message.
- Parameters:
-
- name - the name of the integer property.
- value - the integer property value to set in the Message.
- Throws:
-
- JMSException - if JMS fails to set Property because of an internal JMS
error.
- MessageNotWriteableException - if the properties are read-only.
- setJMSCorrelationID
-
public void setJMSCorrelationID
(java.lang.String correlationID)
throws JMSException
Set the correlation ID for the message.
A client can use the JMSCorrelationID header field to link one message with
another. A typical use is to link a response message with its request
message.
- Note:
- The use of a byte[] value for JMSCorrelationID is
non-portable.
- Parameters:
- correlationID - the message ID of a message being referred to.
- Throws:
- JMSException - if JMS fails to set the correlation ID because of an
internal JMS error.
- See also:
- getJMSCorrelationID(), getJMSCorrelationIDAsBytes(),
setJMSCorrelationIDAsBytes()
- setJMSCorrelationIDAsBytes
-
public void setJMSCorrelationIDAsBytes(byte[]
correlationID)
throws JMSException
Set the correlation ID as an array of bytes for the message. A
client can use this call to set the correlationID equal either to a messageID
from a previous message, or to an application-specific string.
Application-specific strings must not start with the characters ID:
- Parameters:
- correlationID - the correlation ID as a string, or the message ID of a
message being referred to.
- Throws:
- JMSException - if JMS fails to set the correlation ID because of an
internal JMS error.
- See also:
- setJMSCorrelationID(), getJMSCorrelationID(), getJMSCorrelationIDAsBytes()
- setJMSDeliveryMode
-
public void setJMSDeliveryMode(int deliveryMode)
throws JMSException
Set the delivery mode for this message.
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.
To alter the delivery mode when a message is sent, use the setDeliveryMode
method on the QueueSender or TopicPublisher (this method is inherited from
MessageProducer).
- Parameters:
- deliveryMode - the delivery mode for this message.
- Throws:
- JMSException - if JMS fails to set JMS DeliveryMode because of an internal
JMS error.
- See also:
- getJMSDeliveryMode(), DeliveryMode
- setJMSDestination
-
public void setJMSDestination(Destination destination)
throws JMSexception
Set the destination for this message.
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.
- Parameters:
- destination - the destination for this message.
- Throws:
- JMSException - if JMS fails to set JMS Destination because of an internal
JMS error.
- See also:
- getJMSDestination()
- setJMSExpiration
-
public void setJMSExpiration(long expiration)
throws JMSException
Set the message's expiration value.
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.
- Parameters:
- expiration - the message's expiration time.
- Throws:
- JMSException - if JMS fails to set JMS message expiration because of an
internal JMS error.
- See also:
- getJMSExpiration()
- setJMSMessageID
-
public void setJMSMessageID(java.lang.String id)
throws JMSException
Set the message ID.
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.
- Parameters:
- id - the ID of the message.
- Throws:
- JMSException - if JMS fails to set the message ID because of an internal
JMS error.
- See also:
- getJMSMessageID()
- setJMSPriority
-
public void setJMSPriority(int priority)
throws JMSException
Set the priority for this message.
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.
- Parameters:
- priority - the priority of this message.
- Throws:
- JMSException - if JMS fails to set JMS message priority because of an
internal JMS error.
- See also:
- getJMSPriority()
- setJMSRedelivered
-
public void setJMSRedelivered(boolean redelivered)
throws JMSException
Set to indicate whether this message is being redelivered.
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.
- Parameters:
- redelivered - an indication of whether this message is being
redelivered.
- Throws:
- JMSException - if JMS fails to set JMSRedelivered flag because of an
internal JMS error.
- See also:
- getJMSRedelivered()
- setJMSReplyTo
-
public void setJMSReplyTo(Destination replyTo)
throws JMSException
Set where a reply to this message should be sent.
- Parameters:
- replyTo - where to send a response to this message. A null value
indicates that no reply is expected.
- Throws:
- JMSException - if JMS fails to set ReplyTo Destination because of an
internal JMS error.
- See also:
- getJMSReplyTo()
- setJMSTimestamp
-
public void setJMSTimestamp(long timestamp)
throws JMSException
Set the message timestamp.
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.
- Parameters:
- timestamp - the timestamp for this message.
- Throws:
- JMSException - if JMS fails to set the timestamp because of an internal
JMS error.
- See also:
- getJMSTimestamp()
- setJMSType
-
public void setJMSType(java.lang.String type)
throws JMSException
Set the message type.
JMS clients should assign a value to type whether the application makes use
of it or not. This ensures that it is properly set for those providers
that require it.
- Parameters:
- type - the class of message.
- Throws:
- JMSException - if JMS fails to set JMS message type because of an internal
JMS error.
- See also:
- getJMSType()
- setLongProperty
-
public void setLongProperty(java.lang.String name,
long value) throws JMSException
Set a long property value with the given name into the Message.
- Parameters:
-
- name - the name of the long property.
- value - the long property value to set in the Message.
- Throws:
-
- JMSException - if JMS fails to set Property because of an internal JMS
error.
- MessageNotWriteableException - if the properties are read-only.
- setObjectProperty
-
public void setObjectProperty(java.lang.String name,
java.lang.Object value) throws JMSException
Set a property value with the given name into the Message.
- Parameters:
-
- name - the name of the Java object property.
- value - the Java object property value to set in the Message.
- Throws:
-
- JMSException - if JMS fails to set Property because of an internal JMS
error.
- MessageFormatException - if the object is not valid.
- MessageNotWriteableException - if the properties are read-only.
- setShortProperty
-
public void setShortProperty(java.lang.String name,
short value) throws JMSException
Set a short property value with the given name into the Message.
- Parameters:
-
- name - the name of the short property.
- value - the short property value to set in the Message.
- Throws:
-
- JMSException - if JMS fails to set Property because of an internal JMS
error.
- MessageNotWriteableException - if the properties are read-only.
- setStringProperty
-
public void setStringProperty(java.lang.String name,
java.lang.String value) throws JMSException
Set a String property value with the given name into the Message.
- Parameters:
-
- name - the name of the String property.
- value - the String property value to set in the Message.
- Throws:
-
- JMSException - if JMS fails to set the property because of an internal JMS
error.
- MessageNotWriteableException - if the properties are read-only.