|Oracle8i Application Developer's Guide - Advanced Queuing
Release 2 (8.1.6)
Part Number A76938-01
AQ Programmatic Environments, 7 of 10
Using Oracle Java Messaging Service (JMS) to Access AQ
Java Messaging Service (JMS): Java Messaging Service (JMS) is a messaging standard defined by Sun Microsystems along with Oracle, IBM and other vendors. JMS is a set of interfaces and associated semantics that define how a JMS client accesses the facilities of an enterprise messaging product.
Oracle Java Messaging Service (JMS): Oracle Java Messaging Service provides a Java API for Oracle8i Advanced Queuing based on the JMS standard. Oracle JMS supports the standard JMS interfaces and has extensions to support the AQ administrative operations and other AQ features that are not a part of the standard.
Standard JMS Features
Standard JMS features include
- Point-to-point model of communication - using Queues
- Publish-subscribe model of communication - using Topics
- Five types of messages - ObjectMessage, StreamMessage, TextMessage, BytesMessage, MapMessage
- Synchronous and Asynchronous delivery of messages.
- Message selection based on message header fields/properties
Oracle JMS Extensions
Oracle JMS extensions include the following:
- Administrative API - to create Queue Tables, Queues and Topics
- Point-to-multipoint communication - using recipient lists for Topics
- Message propagation between Destinations. Allows the application to define remote subscribers.
- Supports transacted sessions that enable you to perform JMS as well as SQL operations in one atomic transaction.
- Message retention after messages have been dequeued
- Message delay - messages can be made visible after a certain delay
- Exception handling - messages are moved to exception queues if they cannot be processed successfully
- In addition to the standard JMS message types, Oracle8i supports
AdtMessages. These are stored in the database as Oracle Objects and hence the payload of the message can be queried after it is enqueued. Subscriptions can be defined on the contents of these messages as opposed to just the message properties.
Accessing Standard and Oracle JMS
Oracle JMS uses JDBC to connect to the database, hence it applications can run as follows:
- Outside the database using the "OCI8" or "thin" JDBC driver
- Inside Oracle8i JServer using the Oracle Server driver
The standard JMS interfaces are in the javax.jms package.
The Oracle JMS interfaces are in the oracle.jms package.
- Using OCI8 or Thin JDBC Driver: To use JMS with clients running outside the database, you must include the appropriate JDBC driver and the following jar files in your CLASSPATH:
- For JDK 1.1 include the following:
- For JDK 1.2 include the following:
- Using Oracle Server Driver in JServer: 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
Users will also need the appropriate system and Queue or Topic privileges to send or receive messages.
For More Information
Oracle JMS interfaces are described in detail in the Oracle8i Supplied Java Packages Reference,.