Oracle9i Application Developer's Guide - Advanced Queuing Release 2 (9.2) Part Number A96587-01 |
|
This chapter describes the elements you need to work with and issues to consider in preparing your AQ application environment. The following topics are discussed:
The following programmatic environments are used to access the Advanced Queuing functions of Oracle:
Refer to Table 3-1, " AQ Programmatic Environments" for the AQ programmatic environments and syntax references.
Language | Precompiler or Interface Program | Syntax Reference | In This Chapter See... |
---|---|---|---|
PL/SQL |
|
||
C |
Oracle Call Interface (OCI) |
||
Visual Basic |
Oracle Objects For OLE (OO4O) |
Oracle Objects for OLE (OO4O) is a Windows-based product included with Oracle Client for Windows NT. There are no manuals for this product, only online help. Online help is available through the Application Development submenu of the Oracle installation. |
|
Java (AQ) |
|
||
Java (JMS) |
|
"Using AQ Java (oracle.AQ) Classes to Access AQ" and "Using Oracle Java Message Service to Access AQ" |
|
AQ XML Servlet |
|
The PL/SQL packages DBMS_AQADM
and DBMS_AQ
support access to Oracle Advanced Queuing administrative and operational functions using the native AQ interface. These functions include the following:
See Also:
Oracle9i Supplied PL/SQL Packages and Types Reference for detailed documentation, including parameters, parameter types, return values, examples, |
Available PL/SQL DBMS_AQADM
and DBMS_AQ
functions are listed in detail in Table 3-2 through Table 3-9.
Oracle Call Interface (OCI) provides an interface to Oracle Advanced Queuing functions using the native AQ interface.
An OCI client can perform the following actions:
In addition, OCI clients can receive asynchronous notifications for new messages in a queue using OCISubscriptionRegister.
See:
Oracle Call Interface Programmer's Guide: "OCI and Advanced Queuing" and "Publish-Subscribe Notification" sections, for syntax details. |
For queues with user-defined payload type, OTT must be used to generate the OCI mapping for the Oracle type. The OCI client is responsible for freeing the memory of the AQ descriptors and the message payload.
See Appendix A, "Oracle Advanced Queuing by Example" under "Enqueuing and Dequeuing Of Messages" for OCI Advanced Queuing interface examples.
See Appendix A, "Oracle Advanced Queuing by Example" under "AQ and Memory Usage" for examples illustrating memory management of OCI descriptors.
Visual Basic (OO4O) supports access to Oracle Advanced Queuing operational functions using the native AQ interface.
These functions include the following:
For more information about OO4O, refer to the following Web site:
Select Products > Internet Tools > Programmer. Scroll down to: Oracle Objects for OLE. At the bottom of the page is a list of useful articles for using the interfaces.
Search for articles on OO4O or Oracle Objects for OLE.
The Java AQ API supports both the administrative and operational features of Advanced Queueing. In developing Java programs for messaging applications, you use JDBC to open a connection to the database and to oracle.AQ, the Java AQ API for message queuing.
Oracle9i Supplied Java Packages Reference describes the common interfaces and classes based on current PL/SQL interfaces.
The Java AQ classes are located in $ORACLE_HOME
/rdbms
/jlib
/aqapi*
.jar
. In release 9.2, Oracle JMS conforms to Sun Microsystems' JMS 1.0.2b standard. These classes can be used with any OracleJDBC driver, version 8i and higher.
jmscommon.jar
and aqapi
.jar
files into the database using the loadjava
utility.Appendix A, "Oracle Advanced Queuing by Example" contains the following examples:
The various implementations of the Java AQ API are managed with AQDriverManager
. Both OLite and Oracle9i will have an AQDriver
that is registered with the AQDriverManager
. The driver manager is used to create an AQSession
that can be used to perform messaging tasks.
The Oracle8i AQ driver is registered using the Class.forName ("oracle.AQ.AQOracleDriver") command.
When the AQDriverManager
.createAQSession
() method is invoked, it calls the appropriate AQDriver
(among the registered drivers) depending on the parameter passed to the createAQSession
() call.
The Oracle9i AQDriver
expects a valid JDBC connection to be passed in as a parameter to create an AQSession. Users must have the execute privilege on the DBMS_AQIN
package to use the AQ Java 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 privileges for 8.1-style queue tables.
Java Message Service (JMS): JMS is a messaging standard defined by Sun Microsystems, 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 Message Service: Oracle Java Message Service provides a Java API for Oracle 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 include:
Oracle JMS extensions include the following:
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.Oracle JMS uses JDBC to connect to the database, hence it applications can run as follows:
The standard JMS interfaces are in the javax.jms
package.
The Oracle JMS interfaces are in the oracle.jms
package.
$ORACLE_HOME/rdbms/jlib/jmscommon.jar
$ORACLE_HOME/rdbms/jlib/aqapi11.jar
$ORACLE_HOME/jlib/jndi.jar
$ORACLE_HOME/jdbc/lib/classes111.jar
$ORACLE_HOME/rdbms/jlib/jmscommon.jar
$ORACLE_HOME/rdbms/jlib/aqapi.jar
$ORACLE_HOME/jlib/jndi.jar
$ORACLE_HOME/jdbc/lib/classes12.jar
jmscommon.jar
followed by aqapi.jar
using the $ORACLE_HOME/rdbms/admin/initjms
SQL script.Users must have EXECUTE
privilege on the DBMS_AQIN
and DBMS_AQJMS
packages 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.
Oracle JMS interfaces are described in detail in the Oracle9i Supplied Java Packages Reference.
You can use the AQ XML servlet to access Oracle9i AQ over HTTP using Simple Object Access Protocol (SOAP) and an XML message format called Internet Data Access Presentation (IDAP).
Using the AQ servlet, a client can perform the following actions:
The servlet can be created by defining a Java class that extends the oracle.AQ.xml.AQxmlServlet
or oracle.AQ.xml.AQxmlServlet20
class. These classes in turn extend the javax.servlet.http.HttpServlet
class.
The servlet can be deployed on any Web server or ServletRunner that implements Javasoft's Servlet 2.0 or Servlet 2.2 interfaces.
The servlet can be compiled using JDK 1.1.x or JDK 1.2.x libraries.
$ORACLE_HOME/jdbc/lib/classes111.jar $ORACLE_HOME/jlib/jta.jar $ORACLE_HOME/jdbc/lib/nls_charset11.jar $ORACLE_HOME/jlib/jndi.jar $ORACLE_HOME/lib/lclasses11.zip $ORACLE_HOME/lib/xmlparserv2.jar $ORACLE_HOME/lib/xschema.jar $ORACLE HOME/rdbms/jlib/aqapi11.jar $ORACLE_HOME/rdbms/jlib/jmscommon.jar $ORACLE_HOME/rdbms/jlib/aqxml.jar $ORACLE_HOME/rdbms/jlib/xsu111.jar $ORACLE_HOME/lib/servlet.jar
$ORACLE_HOME/jdbc/lib/classes12.jar $ORACLE_HOME/jlib/jta.jar $ORACLE_HOME/jdbc/lib/nls_charset12.jar $ORACLE_HOME/jlib/jndi.jar $ORACLE_HOME/lib/lclasses12.zip $ORACLE_HOME/lib/xmlparserv2.jar $ORACLE_HOME/lib/xschema.jar $ORACLE_HOME/rdbms/jlib/aqapi.jar $ORACLE_HOME/rdbms/jlib/jmscommon.jar $ORACLE_HOME/rdbms/jlib/aqxml.jar $ORACLE_HOME/rdbms/jlib/xsu12.jar $ORACLE_HOME/lib/servlet.jar
Since the servlet uses JDBC OCI drivers to connect to the Oracle9i database server, the 9i Oracle client libraries must be installed on the machine that hosts the servlet. The LD_LIBRARY_PATH
must contain $ORACLE_HOME/lib
.
Refer to Chapter 17, "Internet Access to Advanced Queuing" for more information on Internet access to Advanced Queuing.
Available functions for the AQ programmatic environments are listed by use case in Table 3-2 through Table 3-9. Use cases are described in Chapter 9 through Chapter 11 andChapter 13 through Chapter 16. Refer to Chapter E, "Unified Modeling Language Diagrams" for an explanation of use case diagrams.
Table 3-2 lists the equivalent AQ administrative functions for three programmatic environments, PL/SQL, Java (native AQ), and Java (JMS).
Table 3-3 through Table 3-9 list equivalent AQ operational functions for the programmatic environments PL/SQL, Java (native AQ), OCI, AQ XML Servlet, and JMS, for various use cases.
|
Copyright © 1996, 2002 Oracle Corporation. All Rights Reserved. |
|