Oracle® Streams Advanced Queuing Java API Reference
10g Release 2 (10.2)

B14291-01


oracle.jms
Class AQjmsMessage

java.lang.Object
  extended byoracle.jms.AQjmsMessage

All Implemented Interfaces:
Message
Direct Known Subclasses:
AQjmsAdtMessage, AQjmsBytesMessage, AQjmsMapMessage, AQjmsObjectMessage, AQjmsStreamMessage, AQjmsTextMessage

public class AQjmsMessage
extends java.lang.Object
implements Message

This is an Oracle class which implements javax.jms.Message.


Field Summary

Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE

Method Summary
void acknowledge()
Acknowleges message receipt when using the CLIENT_ACKNOWLEDGE mode.
void clearBody()
Clears out the message body.
void clearProperties()
Clears a message's properties.
int getAttempts()
Gets this message's retry count.
boolean getBooleanProperty(java.lang.String name)
Returns a property value as a boolean.
byte getByteProperty(java.lang.String name)
Returns a property value as a byte.
double getDoubleProperty(java.lang.String name)
Returns a property value as a double.
float getFloatProperty(java.lang.String name)
Returns a property value as a float.
int getIntProperty(java.lang.String name)
Returns a property value as an int.
java.lang.String getJMSCorrelationID()
Gets this message's correlation ID.
byte[] getJMSCorrelationIDAsBytes()
Gets this message's correlation ID as an array of bytes.
int getJMSDeliveryMode()
Gets this message's delivery mode.
Destination getJMSDestination()
Gets this message's destination.
long getJMSExpiration()
Gets this message's expiration value.
java.lang.String getJMSMessageID()
Gets this message's ID.
byte[] getJMSMessageIDAsBytes()
Gets this message's ID as a byte array.
int getJMSPriority()
Gets this message's priority.
boolean getJMSRedelivered()
Gets an indication of whether this message is being redelivered.
Destination getJMSReplyTo()
Gets this message's JMSReplyTo destination.
long getJMSTimestamp()
Gets this message's timestamp.
java.lang.String getJMSType()
Gets this message's type.
long getLongProperty(java.lang.String name)
Returns a property value as a long.
java.lang.Object getObjectProperty(java.lang.String name)
Returns a property value as a Java object.
java.util.Enumeration getPropertyNames()
Returns an Enumeration of all the property names.
oracle.jms.AQjmsAgent getSenderID()
Gets this message's sender ID.
short getShortProperty(java.lang.String name)
Returns a property value as a short.
java.lang.String getStringProperty(java.lang.String name)
Returns a property value as a String.
java.util.Enumeration getUserPropertyNames()
Returns an Enumeration of all the user property names.
boolean propertyExists(java.lang.String name)
Checks if a property value exists.
void setBooleanProperty(java.lang.String name, boolean value)
Sets a property's value to a boolean.
void setByteProperty(java.lang.String name, byte value)
Sets a property's value to a byte.
void setDoubleProperty(java.lang.String name, double value)
Sets a property's value to a double.
void setFloatProperty(java.lang.String name, float value)
Sets a property's value to a float.
void setIntProperty(java.lang.String name, int value)
Sets a property's value to an integer.
void setJMSCorrelationID(java.lang.String correlationID)
Sets this message's correlation ID.
void setJMSCorrelationIDAsBytes(byte[] correlationID)
Sets this message's correlation ID as an array of bytes.
void setJMSDeliveryMode(int deliveryMode)
Sets this message's delivery mode.
void setJMSDestination(Destination destination)
Sets this message's destination.
void setJMSExpiration(long expiration)
Sets this message's expiration value.
void setJMSMessageID(java.lang.String id)
Sets this message's ID.
void setJMSPriority(int priority)
Sets this message's priority.
void setJMSRedelivered(boolean redelivered)
Sets the indication of whether this message is being redelivered.
void setJMSReplyTo(Destination replyTo)
Sets this message's JMSReplyTo destination.
void setJMSTimestamp(long timestamp)
Sets this message's timestamp.
void setJMSType(java.lang.String type)
Sets this message's type.
void setLongProperty(java.lang.String name, long value)
Sets a property's value to a long.
void setObjectProperty(java.lang.String name, java.lang.Object value)
Sets a property's value to a Java object.
void setSenderID(oracle.jms.AQjmsAgent sender)
Sets this message's sender ID.
void setShortProperty(java.lang.String name, short value)
Sets a property's value to a short.
void setStringProperty(java.lang.String name, java.lang.String value)
Sets a property's value to a String.

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

getJMSMessageID

public java.lang.String getJMSMessageID()
                                 throws JMSException
Gets this message's ID. The JMSMessageID header field contains a value that uniquely identifies each message sent by OJMS. When a message is sent, any previous JMSMessageID value is ignored and over-written with a value assigned by OJMS. All JMSMessageID values start with the prefix "ID:".
Specified by:
getJMSMessageID in interface Message
Returns:
the message ID
Throws:
JMSException - if the message ID is not retrieved due to some error.
See Also:
Message.setJMSMessageID(String), MessageProducer.setDisableMessageID(boolean)

getJMSMessageIDAsBytes

public byte[] getJMSMessageIDAsBytes()
                              throws JMSException
Gets this message's ID as a byte array.
Returns:
the message ID
Throws:
JMSException - if the message ID is not retrieved due to some error.

setJMSMessageID

public void setJMSMessageID(java.lang.String id)
                     throws JMSException
Sets this message's ID. OJMS overwrites a message's JMSMessageID header field when the message is sent.
Specified by:
setJMSMessageID in interface Message
Parameters:
id - the ID for this message
Throws:
JMSException - if the message ID is not set due to some error.
See Also:
Message.getJMSMessageID()

getJMSTimestamp

public long getJMSTimestamp()
                     throws JMSException
Gets this message's timestamp. The JMSTimestamp header field contains the time a message was handed off to a provider to be sent. When a message is sent, any previous JMSTimestamp value is ignored and over-written with the time the message was enqueued.
Specified by:
getJMSTimestamp in interface Message
Returns:
timestamp (format is a normal Java millis time value)
Throws:
JMSException - if the timestamp is not retrieved due to some error.
See Also:
Message.setJMSTimestamp(long), MessageProducer.setDisableMessageTimestamp(boolean)

setJMSTimestamp

public void setJMSTimestamp(long timestamp)
                     throws JMSException
Sets this message's timestamp. OJMS overwrites a message's JMSTimestamp header field when the message is sent.
Specified by:
setJMSTimestamp in interface Message
Parameters:
timestamp - the timestamp for this message (format is a normal Java millis time value)
Throws:
JMSException - if the timestamp is not set due to some error.
See Also:
Message.getJMSTimestamp()

getJMSCorrelationID

public java.lang.String getJMSCorrelationID()
                                     throws JMSException
Gets this message's correlation ID.
Specified by:
getJMSCorrelationID in interface Message
Returns:
the correlation ID
Throws:
JMSException - if the correlation ID is not retrieved due to some error.
See Also:
Message.setJMSCorrelationID(String), Message.getJMSCorrelationIDAsBytes(), Message.setJMSCorrelationIDAsBytes(byte[])

getJMSCorrelationIDAsBytes

public byte[] getJMSCorrelationIDAsBytes()
                                  throws JMSException
Gets this message's correlation ID as an array of bytes.
Specified by:
getJMSCorrelationIDAsBytes in interface Message
Returns:
the correlation ID for this message
Throws:
JMSException - if the correlation ID is not retrieved due to some error.
See Also:
Message.setJMSCorrelationID(String), Message.getJMSCorrelationID(), Message.setJMSCorrelationIDAsBytes(byte[])

setJMSCorrelationID

public void setJMSCorrelationID(java.lang.String correlationID)
                         throws JMSException
Sets this message's correlation ID. A client can use the JMSCorrelationID header field to link one message with another.
Specified by:
setJMSCorrelationID in interface Message
Parameters:
correlationID - the message ID of a message being referenced
Throws:
JMSException - if the correlation ID is not set due to some error.
See Also:
Message.getJMSCorrelationID(), Message.getJMSCorrelationIDAsBytes(), Message.setJMSCorrelationIDAsBytes(byte[])

setJMSCorrelationIDAsBytes

public void setJMSCorrelationIDAsBytes(byte[] correlationID)
                                throws JMSException
Sets this message's correlation ID as an array of bytes.
Specified by:
setJMSCorrelationIDAsBytes in interface Message
Parameters:
correlationID - the correlation ID
Throws:
JMSException - if the correlation ID is not set due to some error.
See Also:
Message.setJMSCorrelationID(String), Message.getJMSCorrelationID(), Message.getJMSCorrelationIDAsBytes()

getJMSReplyTo

public Destination getJMSReplyTo()
                          throws JMSException
Gets this message's JMSReplyTo destination.
Specified by:
getJMSReplyTo in interface Message
Returns:
the destination where replies to this message should be sent (an AQjmsAgent)
Throws:
JMSException - if the reply-to destination is not retrieved due to some error.
See Also:
Message.setJMSReplyTo(Destination)

setJMSReplyTo

public void setJMSReplyTo(Destination replyTo)
                   throws JMSException
Sets this message's JMSReplyTo destination.
Specified by:
setJMSReplyTo in interface Message
Parameters:
replyTo - destination where replies to this message should be sent. Must be an AQjmsAgent object (with consumer name and queue/topic address).
Throws:
JMSException - if the reply-to destination is not set due to some error.
See Also:
Message.getJMSReplyTo()

getJMSDestination

public Destination getJMSDestination()
                              throws JMSException
Gets this message's destination. The JMSDestination header field contains the destination to which the message is being sent. When a message is sent, any previous JMSDestination value is ignored and over-written with the destination specified by the send. When a message is received, its destination value is equivalent to the value assigned when it was sent.
Specified by:
getJMSDestination in interface Message
Returns:
the destination
Throws:
JMSException - if the destination is not retrieved due to some error.
See Also:
Message.setJMSDestination(Destination)

setJMSDestination

public void setJMSDestination(Destination destination)
                       throws JMSException
Sets this message's destination. OJMS overwrites a message's JMSDestination header field when the message is sent.
Specified by:
setJMSDestination in interface Message
Parameters:
destination - the destination for this message
Throws:
JMSException - if the destination is not set due to some error.
See Also:
Message.getJMSDestination()

getJMSDeliveryMode

public int getJMSDeliveryMode()
                       throws JMSException
Gets this message's delivery mode.
Specified by:
getJMSDeliveryMode in interface Message
Returns:
the delivery mode
Throws:
JMSException - if the delivery mode is not retrieved due to some error.
See Also:
Message.setJMSDeliveryMode(int), DeliveryMode

setJMSDeliveryMode

public void setJMSDeliveryMode(int deliveryMode)
                        throws JMSException
Sets this message's delivery mode. OJMS overwrites a message's JMSDeliveryMode header field when the message is sent.
Specified by:
setJMSDeliveryMode in interface Message
Parameters:
deliveryMode - the delivery mode for this message (DeliveryMode.PERSISTENT or DeliveryMode.NON_PERSISTENT)
Throws:
JMSException - if the delivery mode is not set due to some error.
See Also:
Message.getJMSDeliveryMode(), DeliveryMode

getJMSRedelivered

public boolean getJMSRedelivered()
                          throws JMSException
Gets 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 commit the transaction (or acknowledge the message).

Specified by:
getJMSRedelivered in interface Message
Returns:
true iff this message is (likely) being redelivered
Throws:
JMSException - if the redelivery flag is not retrieved due to some error.
See Also:
Message.setJMSRedelivered(boolean)

setJMSRedelivered

public void setJMSRedelivered(boolean redelivered)
                       throws JMSException
Sets the indication of whether this message is being redelivered. OJMS overwrites a message's JMSRedelivered header field when the message is delivered.
Specified by:
setJMSRedelivered in interface Message
Parameters:
redelivered - an indication of whether this message is being redelivered
Throws:
JMSException - if the redelivery flag is not set due to some error.
See Also:
Message.getJMSRedelivered()

getJMSType

public java.lang.String getJMSType()
                            throws JMSException
Gets this message's type.
Specified by:
getJMSType in interface Message
Returns:
the type
Throws:
JMSException - if the message type is not retrieved due to some error.
See Also:
Message.setJMSType(String)

setJMSType

public void setJMSType(java.lang.String type)
                throws JMSException
Sets this message's type.
Specified by:
setJMSType in interface Message
Parameters:
type - the type for this message
Throws:
JMSException - if the message type is not set due to some error.
See Also:
Message.getJMSType()

getJMSExpiration

public long getJMSExpiration()
                      throws JMSException
Gets this message's expiration value. OJMS overwrites a message's JMSExpiration header field when the message is sent. If the time-to-live is specified as zero, OJMS sets JMSExpiration to zero (which indicates that the message does not expire). Otherwise OJMS sets JMSExpiration to the sum of the time-to-live value specified by the client and the GMT at the time of the send. When a message's expiration time is reached, the message is moved to the exception queue corresponding to the destination queue/topic.
Specified by:
getJMSExpiration in interface Message
Returns:
the time the message expires (format is a normal Java millis time value)
Throws:
JMSException - if the expiration value is not retrieved due to some error.
See Also:
Message.setJMSExpiration(long)

setJMSExpiration

public void setJMSExpiration(long expiration)
                      throws JMSException
Sets this message's expiration value. OJMS overwrites a message's JMSExpiration header field when the message is sent.
Specified by:
setJMSExpiration in interface Message
Parameters:
expiration - the expiration value for this message (format is a normal Java millis time value)
Throws:
JMSException - if the expiration value is not set due to some error.
See Also:
Message.getJMSExpiration()

getJMSPriority

public int getJMSPriority()
                   throws JMSException
Gets this message's priority. JMS defines a ten level priority value with 0 as the lowest priority and 9 as the highest.
Specified by:
getJMSPriority in interface Message
Returns:
the priority
Throws:
JMSException - if the priority is not retrieved due to some error.
See Also:
Message.setJMSPriority(int)

setJMSPriority

public void setJMSPriority(int priority)
                    throws JMSException
Sets this message's priority. JMS defines a ten level priority value with 0 as the lowest priority and 9 as the highest. OJMS overwrites a message's JMSPriority header field when the message is sent.
Specified by:
setJMSPriority in interface Message
Parameters:
priority - the priority for this message
Throws:
JMSException - if the priority is not set due to some error.
See Also:
Message.getJMSPriority()

clearProperties

public void clearProperties()
                     throws JMSException
Clears a message's properties.
Specified by:
clearProperties in interface Message
Throws:
JMSException - if the message properties are not cleared due to some error.

propertyExists

public boolean propertyExists(java.lang.String name)
                       throws JMSException
Checks if a property value exists.
Specified by:
propertyExists in interface Message
Parameters:
name - the name of the property to check
Returns:
true iff the property exists
Throws:
JMSException - if the property's existence is not checked due to some error.

getBooleanProperty

public boolean getBooleanProperty(java.lang.String name)
                           throws JMSException
Returns a property value as a boolean.
Specified by:
getBooleanProperty in interface Message
Parameters:
name - the name of the property
Returns:
the property's value, converted (if needed) to a boolean
Throws:
JMSException - if the property is not retrieved due to some error.
MessageFormatException - if the conversion is invalid.

getByteProperty

public byte getByteProperty(java.lang.String name)
                     throws JMSException
Returns a property value as a byte.
Specified by:
getByteProperty in interface Message
Parameters:
name - the name of the property
Returns:
the property's value, converted (if needed) to a byte
Throws:
JMSException - if the property is not retrieved due to some error.
MessageFormatException - if the conversion is invalid.

getShortProperty

public short getShortProperty(java.lang.String name)
                       throws JMSException
Returns a property value as a short.
Specified by:
getShortProperty in interface Message
Parameters:
name - the name of the property
Returns:
the property's value, converted (if needed) to a short
Throws:
JMSException - if the property is not retrieved due to some error.
MessageFormatException - if the conversion is invalid.

getIntProperty

public int getIntProperty(java.lang.String name)
                   throws JMSException
Returns a property value as an int.
Specified by:
getIntProperty in interface Message
Parameters:
name - the name of the property
Returns:
the property's value, converted (if needed) to an int
Throws:
JMSException - if the property is not retrieved due to some error.
MessageFormatException - if the conversion is invalid.

getLongProperty

public long getLongProperty(java.lang.String name)
                     throws JMSException
Returns a property value as a long.
Specified by:
getLongProperty in interface Message
Parameters:
name - the name of the property
Returns:
the property's value, converted (if needed) to a long
Throws:
JMSException - if the property is not retrieved due to some error.
MessageFormatException - if the conversion is invalid.

getFloatProperty

public float getFloatProperty(java.lang.String name)
                       throws JMSException
Returns a property value as a float.
Specified by:
getFloatProperty in interface Message
Parameters:
name - the name of the property
Returns:
the property's value, converted (if needed) to a float
Throws:
JMSException - if the property is not retrieved due to some error.
MessageFormatException - if the conversion is invalid.

getDoubleProperty

public double getDoubleProperty(java.lang.String name)
                         throws JMSException
Returns a property value as a double.
Specified by:
getDoubleProperty in interface Message
Parameters:
name - the name of the property
Returns:
the property's value, converted (if needed) to a double
Throws:
JMSException - if the property is not retrieved due to some error.
MessageFormatException - if the conversion is invalid.

getStringProperty

public java.lang.String getStringProperty(java.lang.String name)
                                   throws JMSException
Returns a property value as a String.
Specified by:
getStringProperty in interface Message
Parameters:
name - the name of the property
Returns:
the property's value, converted (if needed) to a String, or null if there is no such property
Throws:
JMSException - if the property is not retrieved due to some error.
MessageFormatException - if the conversion is invalid.

getObjectProperty

public java.lang.Object getObjectProperty(java.lang.String name)
                                   throws JMSException
Returns a property value as a Java object. Note that this method can be used to return, in objectified format, a value that has been stored as a property in the message with the setObjectProperty method or the format's equivalent primitive settypeProperty method.
Specified by:
getObjectProperty in interface Message
Parameters:
name - the name of the property
Returns:
the property's value, converted (if needed) to objectified format (e.g., int is converted to Integer), or null if there is no such property
Throws:
JMSException - if the property is not retrieved due to some error.

getPropertyNames

public java.util.Enumeration getPropertyNames()
                                       throws JMSException
Returns an Enumeration of all the property names.
Specified by:
getPropertyNames in interface Message
Returns:
the enumeration
Throws:
JMSException - if the enumeration is not retrieved due to some error.

getUserPropertyNames

public java.util.Enumeration getUserPropertyNames()
                                           throws JMSException
Returns an Enumeration of all the user property names.
Returns:
the enumeration
Throws:
JMSException - if the enumeration is not retrieved due to some error.

setBooleanProperty

public void setBooleanProperty(java.lang.String name,
                               boolean value)
                        throws JMSException
Sets a property's value to a boolean. If the property does not already exist, it is added to this message.
Specified by:
setBooleanProperty in interface Message
Parameters:
name - the name of the property
value - the value for the property
Throws:
JMSException - if the property is not set due to some error.
java.lang.IllegalArgumentException - if the name is null or is an empty string.
MessageNotWriteableException - if properties are read-only.

setByteProperty

public void setByteProperty(java.lang.String name,
                            byte value)
                     throws JMSException
Sets a property's value to a byte. If the property does not already exist, it is added to this message.
Specified by:
setByteProperty in interface Message
Parameters:
name - the name of the property
value - the value for the property
Throws:
JMSException - if the property is not set due to some error.
java.lang.IllegalArgumentException - if the name is null or is an empty string.
MessageNotWriteableException - if properties are read-only.

setShortProperty

public void setShortProperty(java.lang.String name,
                             short value)
                      throws JMSException
Sets a property's value to a short. If the property does not already exist, it is added to this message.
Specified by:
setShortProperty in interface Message
Parameters:
name - the name of the property
value - the value for the property
Throws:
JMSException - if the property is not set due to some error.
java.lang.IllegalArgumentException - if the name is null or is an empty string.
MessageNotWriteableException - if properties are read-only.

setIntProperty

public void setIntProperty(java.lang.String name,
                           int value)
                    throws JMSException
Sets a property's value to an integer. If the property does not already exist, it is added to this message.
Specified by:
setIntProperty in interface Message
Parameters:
name - the name of the property
value - the value for the property
Throws:
JMSException - if the property is not set due to some error.
java.lang.IllegalArgumentException - if the name is null or is an empty string.
MessageNotWriteableException - if properties are read-only.

setLongProperty

public void setLongProperty(java.lang.String name,
                            long value)
                     throws JMSException
Sets a property's value to a long. If the property does not already exist, it is added to this message.
Specified by:
setLongProperty in interface Message
Parameters:
name - the name of the property
value - the value for the property
Throws:
JMSException - if the property is not set due to some error.
java.lang.IllegalArgumentException - if the name is null or is an empty string.
MessageNotWriteableException - if properties are read-only.

setFloatProperty

public void setFloatProperty(java.lang.String name,
                             float value)
                      throws JMSException
Sets a property's value to a float. If the property does not already exist, it is added to this message.
Specified by:
setFloatProperty in interface Message
Parameters:
name - the name of the property
value - the value for the property
Throws:
JMSException - if the property is not set due to some error.
java.lang.IllegalArgumentException - if the name is null or is an empty string.
MessageNotWriteableException - if properties are read-only.

setDoubleProperty

public void setDoubleProperty(java.lang.String name,
                              double value)
                       throws JMSException
Sets a property's value to a double. If the property does not already exist, it is added to this message.
Specified by:
setDoubleProperty in interface Message
Parameters:
name - the name of the property
value - the value for the property
Throws:
JMSException - if the property is not set due to some error.
java.lang.IllegalArgumentException - if the name is null or is an empty string.
MessageNotWriteableException - if properties are read-only.

setStringProperty

public void setStringProperty(java.lang.String name,
                              java.lang.String value)
                       throws JMSException
Sets a property's value to a String. If the property does not already exist, it is added to this message.
Specified by:
setStringProperty in interface Message
Parameters:
name - the name of the property
value - the value for the property
Throws:
JMSException - if the property is not set due to some error.
java.lang.IllegalArgumentException - if the name is null or is an empty string.
MessageNotWriteableException - if properties are read-only.

setObjectProperty

public void setObjectProperty(java.lang.String name,
                              java.lang.Object value)
                       throws JMSException
Sets a property's value to a Java object. If the property does not already exist, it is added to this message.
Specified by:
setObjectProperty in interface Message
Parameters:
name - the name of the property
value - the value for the property - must be an objectified primitive (e.g., an Integer) or a String
Throws:
JMSException - if the property is not set due to some error.
java.lang.IllegalArgumentException - if the name is null or is an empty string.
MessageFormatException - if value is null or is neither an objectified primitive nor a String.
MessageNotWriteableException - if properties are read-only.

acknowledge

public void acknowledge()
                 throws JMSException
Acknowleges message receipt when using the CLIENT_ACKNOWLEDGE mode.
Specified by:
acknowledge in interface Message
Throws:
JMSException - if SQL exceptions occur during transaction commit.
See Also:
Session.CLIENT_ACKNOWLEDGE

clearBody

public void clearBody()
               throws JMSException
Clears out the message body. All other parts of the message are left untouched.
Specified by:
clearBody in interface Message
Throws:
JMSException - if the message body is not cleared due to some error.

getSenderID

public oracle.jms.AQjmsAgent getSenderID()
                                  throws JMSException
Gets this message's sender ID. This value is available only if it was set by the sender before sending the message.
Returns:
AQjmsAgent representing sender
Throws:
JMSException - if the sender ID is not retrieved due to some error.

setSenderID

public void setSenderID(oracle.jms.AQjmsAgent sender)
                 throws JMSException
Sets this message's sender ID.
Parameters:
sender - AQjmsAgent representing sender
Throws:
JMSException - if the SenderID is not set due to some error.

getAttempts

public int getAttempts()
                throws JMSException
Gets this message's retry count.
Returns:
the number of attempts already made (always one less than the JMSXDeliveryCount property)
Throws:
JMSException - if the retry count can not be retrieved due to some error.

Oracle® Streams Advanced Queuing Java API Reference
10g Release 2 (10.2)

B14291-01


Copyright © 2003, 2005, Oracle. All rights reserved.