| Oracle9i Supplied Java Packages Reference Release 2 (9.2) Part Number A96609-01 |
|
This chapter describes the Oracle Java Messaging Service (OJMS) interfaces and classes that are contained in package oracle.jms. The Oracle JMS interfaces extend the standard JMS interfaces to support the Oracle9i Advanced Queing (AQ) administrative operations and other AQ features that are not included in the public standard contained in the javax.jms package.
This chapter contains these sections:
The Oracle package oracle.jms provides a set of interfaces and associated semantics based on the Java Messaging Service (JMS) standard. These interfaces define how a JMS client accesses the facilities of an enterprise messaging product like Oracle9i Advanced Queuing. Advanced Queuing (AQ) is the unique database-integrated message queuing feature of the Oracle9i database. Oracle supports the standard JMS interfaces and has extensions to support the AQ administrative operations and other AQ features that are not included in the public standard.
Oracle JMS uses JDBC to connect to the database. Therefore, its applications can run as follows:
The standard JMS interfaces are contained in the javax.jms package (refer to Sun J2EE documentation for details). The Oracle JMS interfaces extend javax.jms and are contained in the oracle.jms package.
To use JMS interfaces with clients running outside the database, you must include the appropriate JDBC driver, JNDI jar files, and the following AQ jar files in your CLASSPATH. (The CLASSPATH is the operating system environmental variable that the JVM uses to find the classes it needs to run applications.)
For JDK 1.3 include:
$ORACLE_HOME/rdbms/jlib/jmscommon.jar $ORACLE_HOME/rdbms/jlib/aqapi13.jar $ORACLE_HOME/jdbc/lib/jndi.zip $ORACLE_HOME/jdbc/lib/classes13.zip
For JDK 1.2 include:
$ORACLE_HOME/rdbms/jlib/jmscommon.jar $ORACLE_HOME/rdbms/jlib/aqapi12.jar $ORACLE_HOME/jdbc/lib/jndi.zip $ORACLE_HOME/jdbc/lib/classes12.zip
For JDK 1.1 include:
$ORACLE_HOME/rdbms/jlib/jmscommon.jar $ORACLE_HOME/rdbms/jlib/aqapi11.jar $ORACLE_HOME/jdbc/lib/jndi.zip $ORACLE_HOME/jdbc/lib/classes11.zip
If your application is running inside the JServer, you should be able to access the Oracle JMS classes that have been automatically loaded when the JServer was installed. If these classes are not available, you may have to load jmscommon.jar followed by aqapi.jar using the loadjava utility.
Users must have EXECUTE privilege on DBMS_AQIN and DBMS_AQJMS packages in order to use the Oracle JMS interfaces. Users can also acquire these rights through the AQ_USER_ROLE or the AQ_ADMINSTRATOR_ROLE.
Users will also need the appropriate system and Queue or Topic privileges to send or receive messages.
public interface AdtMessage extends javax.jms.Message
javax.jms.Message
AQjmsAdtMessage
This interface extends the Message interface and represents messages containing Oracle object type payloads.
| Member Summary | Description |
|---|---|
|
Methods |
- |
|
Get the CustomDatum object containing this Adt message's data. |
|
|
Set the CustomDatum object containing this Adt message's data |
public oracle.sql.CustomDatum getAdtPayload()
Get the CustomDatum object containing this Adt message's data.
the object containing this message's data
JMSException - if JMS fails to get object due to some internal JMS error.
public void setAdtPayload(oracle.sql.CustomDatum payload)
set the CustomDatum object containing this ADT message's data.
ADT is for Asynchronous Data Transfer.
payload - the message's data (the object must implement the CustomDatum interface). This payload must be a Java object that represents the ADT that is defined as the queue/topic payload type.
JMSException - if JMS fails to set the ADT payload
MessageNotWriteableException - if message in read-only mode.
public class AQjmsAdtMessage extends AQjmsMessage implements AdtMessage java.lang.Object | +--AQjmsMessage | +--oracle.jms.AQjmsAdtMessage
AdtMessage, javax.jms.Message
This class implements the AdtMessage interface. An AdtMessage is used to send a message containing Oracle object type payloads
public void clearBody()
Clear out the message body. All other parts of the message are left untouched.
javax.jms.Message.clearBody() in interface javax.jms.Message
javax.jms.Message.clearBody() in interface javax.jms.Message
clearBody() in class AQjmsMessage
JMSException - if JMS fails to due to some internal JMS error.
public oracle.sql.CustomDatum getAdtPayload()
Get the CustomDatum object containing this Adt message's data.
getAdtPayload() in interface AdtMessage
the object containing this message's data
JMSException - if JMS fails to get object due to some internal JMS error.
public boolean getBooleanProperty(java.lang.String name)
Return the boolean property value with the given name.
javax.jms.Message.getBooleanProperty(java.lang.String) in interface javax.jms.Message
getBooleanProperty(String) in class AQjmsMessage
name - the name of the boolean property
the boolean property value with the given name.
JMSException - if JMS fails to get Property due to some internal JMS error.
MessageFormatException - if this type conversion is invalid.
public byte getByteProperty(java.lang.String name)
Return the byte property value with the given name.
javax.jms.Message.getByteProperty(java.lang.String) in interface javax.jms.Message
getByteProperty(String) in class AQjmsMessage
name - the name of the byte property
the byte property value with the given name.
JMSException - if JMS fails to get Property due to some internal JMS error.
MessageFormatException - if this type conversion is invalid.
public double getDoubleProperty(java.lang.String name)
Return the double property value with the given name.
javax.jms.Message.getDoubleProperty(java.lang.String) in interface javax.jms.Message
getDoubleProperty(String) in class AQjmsMessage
name - the name of the double property
the double property value with the given name.
JMSException - if JMS fails to get Property due to some internal JMS error.
MessageFormatException - if this type conversion is invalid.
public float getFloatProperty(java.lang.String name)
Return the float property value with the given name.
javax.jms.Message.getFloatProperty(java.lang.String) in interface javax.jms.Message
getFloatProperty(String) in class AQjmsMessage
name - the name of the float property
the float property value with the given name.
JMSException - if JMS fails to get Property due to some internal JMS error.
MessageFormatException - if this type conversion is invalid.
public int getIntProperty(java.lang.String name)
Return the integer property value with the given name.
javax.jms.Message.getIntProperty(java.lang.String) in interface javax.jms.Message
getIntProperty(String) in class AQjmsMessage
name - the name of the integer property
the integer property value with the given name.
JMSException - if JMS fails to get Property due to some internal JMS error.
MessageFormatException - if this type conversion is invalid.
public javax.jms.Destination getJMSReplyTo()
Get where a reply to this message should be sent. This method is not supported for AdtMessages in this release
javax.jms.Message.getJMSReplyTo() in interface javax.jms.Message
getJMSReplyTo() in class AQjmsMessage
JMSException - NOT_SUPPORTED for AdtMessage
public java.lang.String getJMSType()
Get the message type.This method is not supported for AdtMessages in this release
javax.jms.Message.getJMSType() in interface javax.jms.Message
getJMSType() in class AQjmsMessage
the message type
JMSException - NOT_SUPPORTED for AdtMessage
public long getLongProperty(java.lang.String name)
Return the long property value with the given name.
javax.jms.Message.getLongProperty(java.lang.String) in interface javax.jms.Message
getLongProperty(String) in class AQjmsMessage
name - the name of the long property
the long property value with the given name.
JMSException - if JMS fails to get Property due to some internal JMS error.
MessageFormatException - if this type conversion is invalid.
public java.lang.Object getObjectProperty(java.lang.String name)
Return the Java object property value with the given name.
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 method.
javax.jms.Message.getObjectProperty(java.lang.String) in interface javax.jms.Message
getObjectProperty(String) in class AQjmsMessage
name - the name of the Java object property
the Java object property value with the given name, in objectified format (i.e. if it set as an int, then a Integer is returned). If there is no property by this name, a null value is returned.
JMSException - if JMS fails to get Property due to some internal JMS error.
public synchronized java.util.Enumeration getPropertyNames()
Return an Enumeration of all the property names.
javax.jms.Message.getPropertyNames() in interface javax.jms.Message
getPropertyNames() in class AQjmsMessage
an enumeration of all the names of property values.
JMSException - if JMS fails to get Property names due to some internal JMS error.
public short getShortProperty(java.lang.String name)
Return the short property value with the given name.
javax.jms.Message.getShortProperty(java.lang.String) in interface javax.jms.Message
getShortProperty(String) in class AQjmsMessage
name - the name of the short property
the short property value with the given name.
JMSException - if JMS fails to get Property due to some internal JMS error.
MessageFormatException - if this type conversion is invalid.
public java.lang.String getStringProperty(java.lang.String name)
Return the String property value with the given name.
javax.jms.Message.getStringProperty(java.lang.String) in interface javax.jms.Message
getStringProperty(String) in class AQjmsMessage
name - the name of the String property
the String property value with the given name. If there is no property by this name, a null value is returned.
JMSException - if JMS fails to get Property due to some internal JMS error.
MessageFormatException - if this type conversion is invalid.
public boolean propertyExists(java.lang.String name)
Check if a property value exists.
javax.jms.Message.propertyExists(java.lang.String) in interface javax.jms.Message
propertyExists(String) in class AQjmsMessage
name - the name of the property to test
true if the property does exist.
JMSException - if JMS fails to check if property exists due to some internal JMS error.
public void setAdtPayload(oracle.sql.CustomDatum payload)
set the CustomDatum object containing this Adt message's data
setAdtPayload(CustomDatum) in interface AdtMessage
payload - the message's data (the object must implement the CustomDatum interface). This payload must be a java object that represents the ADT that is defined as the queue/topic payload type
JMSException - if JMS fails to set the adt payload
MessageNotWriteableException - if message in read-only mode.
public void setBooleanProperty(java.lang.String name, boolean value)
Set a boolean property value with the given name, into the Message.
javax.jms.Message.setBooleanProperty(java.lang.String, boolean) in interface javax.jms.Message
setBooleanProperty(String, boolean) in class AQjmsMessage
name - the name of the boolean property
value - the boolean property value to set in the Message.
JMSException - if JMS fails to set Property due to some internal JMS error.
MessageNotWriteableException - if properties are read-only
public void setByteProperty(java.lang.String name, byte value)
Set a byte property value with the given name, into the Message.
javax.jms.Message.setByteProperty(java.lang.String, byte) in interface javax.jms.Message
setByteProperty(String, byte) in class AQjmsMessage
name - the name of the byte property
value - the byte property value to set in the Message.
JMSException - if JMS fails to set Property due to some internal JMS error.
MessageNotWriteableException - if properties are read-only
public void setDoubleProperty(java.lang.String name, double value)
Set a double property value with the given name, into the Message.
javax.jms.Message.setDoubleProperty(java.lang.String, double) in interface javax.jms.Message
setDoubleProperty(String, double) in class AQjmsMessage
name - the name of the double property
value - the double property value to set in the Message.
JMSException - if JMS fails to set Property due to some internal JMS error.
MessageNotWriteableException - if properties are read-only
public void setFloatProperty(java.lang.String name, float value)
Set a float property value with the given name, into the Message.
javax.jms.Message.setFloatProperty(java.lang.String, float) in interface javax.jms.Message
setFloatProperty(String, float) in class AQjmsMessage
name - the name of the float property
value - the float property value to set in the Message.
JMSException - if JMS fails to set Property due to some internal JMS error.
MessageNotWriteableException - if properties are read-only
public void setIntProperty(java.lang.String name, int value)
Set an integer property value with the given name, into the Message.
javax.jms.Message.setIntProperty(java.lang.String, int) in interface javax.jms.Message
setIntProperty(String, int) in class AQjmsMessage
name - the name of the integer property
value - the integer property value to set in the Message.
JMSException - if JMS fails to set Property due to some internal JMS error.
MessageNotWriteableException - if properties are read-only
public void setJMSReplyTo(javax.jms.Destination replyTo)
Set where a reply to this message should be sent. This method is not supported for AdtMessage in this release
javax.jms.Message.setJMSReplyTo(javax.jms.Destination) in interface javax.jms.Message
setJMSReplyTo(Destination) in class AQjmsMessage
JMSException - NOT_SUPPORTED for AdtMessage
public void setJMSType(java.lang.String type)
Set the message type. This method is not supported for AdtMessages in this release
javax.jms.Message.setJMSType(java.lang.String) in interface javax.jms.Message
setJMSType(String) in class AQjmsMessage
type - of the message
JMSException - NOT_SUPPORTED for AdtMessage
public void setLongProperty(java.lang.String name, long value)
Set a long property value with the given name, into the Message.
javax.jms.Message.setLongProperty(java.lang.String, long) in interface javax.jms.Message
setLongProperty(String, long) in class AQjmsMessage
name - the name of the long property
value - the long property value to set in the Message.
JMSException - if JMS fails to set Property due to some internal JMS error.
MessageNotWriteableException - if properties are read-only
public void setObjectProperty(java.lang.String name, java.lang.Object value)
Set a Java object property value with the given name, into the Message.
Note that this method only works for the objectified primitive object types (Integer, Double, Long ...) and String's.
javax.jms.Message.setObjectProperty(java.lang.String, java.lang.Object) in interface javax.jms.Message
setObjectProperty(String, Object) in class AQjmsMessage
name - the name of the Java object property.
value - the Java object property value to set in the Message.
JMSException - if JMS fails to set Property due to some internal JMS error.
MessageFormatException - if object is invalid
MessageNotWriteableException - if properties are read-only
public void setShortProperty(java.lang.String name, short value)
Set a short property value with the given name, into the Message.
javax.jms.Message.setShortProperty(java.lang.String, short) in interface javax.jms.Message
setShortProperty(String, short) in class AQjmsMessage
name - the name of the short property
value - the short property value to set in the Message.
JMSException - if JMS fails to set Property due to some internal JMS error.
MessageNotWriteableException - if properties are read-only
public void setStringProperty(java.lang.String name, java.lang.String value)
Set a String property value with the given name, into the Message.
javax.jms.Message.setStringProperty(java.lang.String, java.lang.String) in interface javax.jms.Message
setStringProperty(String, String) in class AQjmsMessage
name - the name of the String property
value - the String property value to set in the Message.
JMSException - if JMS fails to set Property due to some internal JMS error.
MessageNotWriteableException - if properties are read-only
public class AQjmsAgent implements javax.jms.Destination oracle.jms.AQjmsAgent
javax.jms.Destination
This class implements the Destination interface. It is used to define remote subscribers and ReplyTo Destinations
public AQjmsAgent(java.lang.String name, java.lang.String address)
Constructor
name - Name of the agent
address - Address of the agent
SQLException - if it fails to create an agent
public AQjmsAgent(java.lang.String name, java.lang.String address, int protocol)
Constructor
name - Name of the agent
address - Address of the agent
protocol - Protocol of the agent
SQLException - if it fails to create an agent
public java.lang.String getAddress()
Get the address of the agent
the address of the agent
SQLException - if there was an error in getting the address
public java.lang.String getName()
Get the name of the agent
the name of the agent
SQLException - if there was an error in getting the name
public int getProtocol()
Get the protocol of the agent
the protocol of the agent
SQLException - if there was an error in getting the protocol
public void setAddress(java.lang.String address)
Set the address of the agent
address - the address of the agent
SQLException - if there was an error in setting the address
public void setName(java.lang.String name)
Set the name of the agent
name - the name of the agent
SQLException - if there was an error in setting the name
public void setProtocol(int protocol)
Set the protocol of the agent
protocol - the protocol of the agent
SQLException - if there was an error in setting the address
public java.lang.String toString()
Convert the agent to its string representation which is of the form: "[AQjmsAgent] \n name: NAME \n address: ADDRESS \n protocol: PROTOCOL"
the string representation of the agent
SQLException - if there was an error in setting the address
public class AQjmsBytesMessage extends AQjmsMessage implements javax.jms.BytesMessage java.lang.Object | +--AQjmsMessage | +--oracle.jms.AQjmsBytesMessage
javax.jms.BytesMessage, javax.jms.Message
This class implements the BytesMessage interface. A BytesMessage is used to send a message containing a stream of uninterpreted bytes
public void clearBody()
Clear out the message body. All other parts of the message are left untouched.
javax.jms.Message.clearBody() in interface javax.jms.Message
clearBody() in class AQjmsMessage
JMSException - if JMS fails to due to some internal JMS error.
public void clearProperties()
Clear a message's properties.
javax.jms.Message.clearProperties() in interface javax.jms.Message
clearProperties() in class AQjmsMessage
JMSException - if JMS fails to clear JMS message properties due to some internal JMS error.
public boolean readBoolean()
Read a boolean from the stream message.
javax.jms.BytesMessage.readBoolean() in interface javax.jms.BytesMessage
the boolean value read.
MessageNotReadableException - if message in write-only mode.
JMSException - if JMS fails to read message due to some internal JMS error.
MessageEOFException - if end of message stream
public byte readByte()
Read a signed 8-bit value from the stream message.
javax.jms.BytesMessage.readByte() in interface javax.jms.BytesMessage
the next byte from the stream message as a signed 8-bit byte.
MessageNotReadableException - if message in write-only mode.
MessageEOFException - if end of message stream
JMSException - if JMS fails to read message due to some internal JMS error.
public int readBytes(byte[] value)
Read a byte array from the stream message.
javax.jms.BytesMessage.readBytes(byte[]) in interface javax.jms.BytesMessage
value - the buffer into which the data is read.
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
MessageNotReadableException - if message in write-only mode.
MessageEOFException - if end of message stream
JMSException - if JMS fails to read message due to some internal JMS error.
public int readBytes(byte[] value, int length)
Read a portion of the bytes message.
javax.jms.BytesMessage.readBytes(byte[], int) in interface javax.jms.BytesMessage
value - the buffer into which the data is read.
length - the number of bytes to read.
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
MessageNotReadableException - if message in write-only mode.
MessageEOFException - if end of message stream
JMSException - if JMS fails to read message due to some internal JMS error.
public char readChar()
Read a Unicode character value from the stream message.
javax.jms.BytesMessage.readChar() in interface javax.jms.BytesMessage
the next two bytes from the stream message as a Unicode character.
MessageNotReadableException - if message in write-only mode.
MessageEOFException - if end of message stream
JMSException - if JMS fails to read message due to some internal JMS error.
public double readDouble()
Read a double from the stream message.
javax.jms.BytesMessage.readDouble() in interface javax.jms.BytesMessage
the next eight bytes from the stream message, interpreted as a double.
MessageNotReadableException - if message in write-only mode.
MessageEOFException - if end of message stream
JMSException - if JMS fails to read message due to some internal JMS error.
public float readFloat()
Read a float from the stream message.
javax.jms.BytesMessage.readFloat() in interface javax.jms.BytesMessage
the next four bytes from the stream message, interpreted as a float.
MessageNotReadableException - if message in write-only mode.
MessageEOFException - if end of message stream
JMSException - if JMS fails to read message due to some internal JMS error.
public int readInt()
Read a signed 32-bit integer from the stream message.
javax.jms.BytesMessage.readInt() in interface javax.jms.BytesMessage
the next four bytes from the stream message, interpreted as an int.
MessageNotReadableException - if message in write-only mode.
MessageEOFException - if end of message stream
JMSException - if JMS fails to read message due to some internal JMS error.
public long readLong()
Read a signed 64-bit integer from the stream message.
javax.jms.BytesMessage.readLong() in interface javax.jms.BytesMessage
the next eight bytes from the stream message, interpreted as a long.
MessageNotReadableException - if message in write-only mode.
MessageEOFException - if end of message stream
JMSException - if JMS fails to read message due to some internal JMS error.
public short readShort()
Put the message in read-only mode, and reposition the stream of bytes to the beginning. ThrowsMessageNotWriteableException - if message in write-only mode. JMSException - if JMS fails to read message due to some internal JMS error.
javax.jms.BytesMessage.readShort() in interface javax.jms.BytesMessage
public int readUnsignedByte()
Read an unsigned 8-bit number from the stream message.
javax.jms.BytesMessage.readUnsignedByte() in interface javax.jms.BytesMessage
the next byte from the stream message, interpreted as an unsigned 8-bit number.
MessageNotReadableException - if message in write-only mode.
MessageEOFException - if end of message stream
JMSException - if JMS fails to read message due to some internal JMS error.
public int readUnsignedShort()
Read an unsigned 16-bit number from the stream message.
javax.jms.BytesMessage.readUnsignedShort() in interface javax.jms.BytesMessage
the next two bytes from the stream message, interpreted as an unsigned 16-bit integer.
MessageNotReadableException - if message in write-only mode.
MessageEOFException - if end of message stream
JMSException - if JMS fails to read message due to some internal JMS error.
public java.lang.String readUTF()
Read in a string that has been encoded using a modified UTF-8 format from the stream message.
javax.jms.BytesMessage.readUTF() in interface javax.jms.BytesMessage
a Unicode string from the stream message.
MessageNotReadableException - if message in write-only mode.