Legal | Privacy
Using Advanced Queuing on the Internet
 
 

Using Advanced Queuing on the Internet

Module Objectives

Purpose

This module describes how to access and use Advanced Queuing over the Internet.

Objectives

After completing this module, you should be able to:

Setup the Internet Access to AQ environment

Run an enqueue from the internet
Run a dequeue from the internet
Verify the existance of a customer using a transformation

Prerequisites

Before starting this module, you should have:

Completed the Preinstallation Tasks module

Completed the Installing the Oracle9i Database module

Completed the Postinstallation Tasks module
Completed the Reviewing the Sample Schemas module
Completed the Integration with Advanced Queuing module
Downloaded the aqinternet.zip module files and unzipped them into your working directory

Reference Material

The following is a list of useful reference material if you want additional information about the topics in this module:

Documentation: Oracle9i Application Developers Guide - Advanced Queuing

 

Overview

E-businesses have the need to communicate with their business partners and customers over multiple channels - call center applications, Internet, and other applications. These business communications are the critical business asset and demand highest degree of reliability and security. In today’s age of twenty four hour business, IT infrastructure needs to provide 24x7 availability. These communications need to be recorded for future references and legal reasons.

Advanced Queuing is the database integrated message queuing feature designed to meet these requirements. It offers multiple APIs for e-businesses to design different applications. Oracle9i offers new XML-based API to Advanced Queuing which can be used for businesses to communicate securely over the Internet with its business customers and partners. Its automatic and guaranteed message propagation feature enables automatic business message communication between applications of business partners.

Advanced Queuing offers two models for communications with businesses and customers over the Internet.

Internet client communication

Automatic message propagation over the Internet

Internet Client Communication

An internet client application can communicate over HTTP(s) and Email with a queue in Oracle database via XML-based protocol. We call this protocol Internet Data Access Protocol (IDAP). IDAP is the SOAP specification for AQ operations. It also offers transactional access, security, and characterset id conversions. This is useful for communicating with customers and business partners via thin applications on the client side. These applications can be simple javascript that generate IDAP message and sent to AQ Servlet via HTTP(s) POST.

Automatic Message Propagation Over the Internet

Alternative way to communicate with business partners and customers is using automatic message propagation over the Internet. This feature offers guaranteed, automatic, and tunable propagation from a queue in an Oracle database to the queues in other Oracle databases over the Internet. This is useful for automatic communication with the business processes of the partners and customers.

 

Setup the Internet Access to AQ Environment

In order to access AQ through the internet, you will need to perform the following setup steps:

1.

Open a DOS window and execute the following statements:

d:\
cd oracle\ora92\Apache\Apache\bin
htpasswd -cd aqpasswd bob
<when prompted for the password, enter welcome>
htpasswd -d aqpasswd jane
<when prompted for the password, enter welcome>


2.

Edit the jserv.conf file in the ORACLE_HOME\Apache\jserv\conf directory. Perform a find on ApJservMount and add the following lines:

ApJservMount /AQServlet /root
ApJServGroupMount /AQServlet balance://group1/root

Note: Make sure the statements are moved to their appropriate sections in the file.

Save and close the file.

 

3.

Edit the jserv.properties file in the ORACLE_HOME\Apache\jserv\conf directory. Check to make sure the following classes are specified:

wrapper.bin.parameters=-mx256M
wrapper.classpath=d:\oracle\ora92\rdbms\jlib\aqapi.jar
wrapper.classpath=d:\oracle\ora92\rdbms\jlib\jmscommon.jar
wrapper.classpath=d:\oracle\ora92\rdbms\jlib\aqxml.jar
wrapper.classpath=d:\oracle\ora92\rdbms\jlib\xsu12.jar
wrapper.classpath=d:\oracle\ora92\lib\xmlparserv2.jar
wrapper.classpath=d:\oracle\ora92\lib\xschema.jar
wrapper.classpath=d:\oracle\ora92\lib\servlet.jar
wrapper.classpath=d:\oracle\ora92\lib\lclasses12.zip
wrapper.classpath=d:\oracle\ora92\jlib\jndi.jar
wrapper.classpath=d:\oracle\ora92\jlib\jta.jar
wrapper.classpath=d:\oracle\ora92\jdbc\lib\classes12.zip
wrapper.classpath=d:\oracle\ora92\jdbc\lib\nls_charset12.zip
Also verify that the environment variables ORACLE_SID, 
        ORACLE_HOME, LD_LIBRARY_PATH are defined.

Save and close the file.

 

4.

Edit the httpd.conf file in the ORACLE_HOME\Apache\Apache\conf directory. Add the following alias:

Alias /orders/ "D:\wkdir/"

Add the following location to restrict access to only the two AQ agents registered in the aqpasswd file.

<Location /AQServlet/>
<Limit POST>
AuthName "AQ restrictions for users"
AuthType Basic
AuthUserFile "d:\oracle\ora92\Apache\Apache\bin\aqpasswd"
require valid-user
</Limit>
</Location>

Save and close the file.

5.

Update the classpath.bat file in your working directory and make sure that your directories are correct:

SET CLASSPATH=.;d:\oracle\ora92\jdbc\lib\classes12.zip;
d:\oracle\ora92\jdbc\lib\nls_charset12.zip;
d:\oracle\ora92\rdbms\jlib\aqapi.jar;
d:\oracle\ora92\rdbms\jlib\jmscommon.jar;
d:\oracle\ora92\rdbms\jlib\aqxml.jar;
d:\oracle\ora92\rdbms\jlib\xsu12.jar;
d:\oracle\ora92\jlib\jndi.jar;
d:\oracle\ora92\jlib\jta.jar;
d:\oracle\ora92\lib\xmlparserv2.jar;
d:\oracle\ora92\lib\xschema.jar;
d:\oracle\ora92\lib\servlet.jar;
d:\oracle\ora92\jlib\javax-ssl-1_2.jar;
d:\oracle\ora92\lib\http_client.jar;

Save and close the file.

6.

Edit the OrderForm.html file with notepad. Search for .us.oracle.com and change the value to your <hostname> and port if is it different than 7778. Save and close the file.

 

7.

Edit the AQOrder.java file with notepad. Search for host and change the value to your <hostname>. Save and close the file.

 

8.

Switch to your DOS window and change to your working directory and execute the following:

classpath
d:\oracle\ora92\jdk\bin\javac AQOrder.java

 

9.

Copy the AQOrder.class file from your working directory to your servlets directory d:\oracle\ora92\Apache\Jserv\servlets.

 

10.

From a SQL*Plus session and execute the following script:

@ia_priv.sql
REM script name: ia_priv.sql
REM grants privileges to enqueue and dequeue to user ix
REM Creates Internet users Bob and Jane
REM Grants appropriate privileges to ix for internet_access
REM
REM version: 9.0.1
REM change: initial version
REM
PROMPT
PROMPT specify password for IX as parameter 1:
define ix_pass = &1
PROMPT specify password for SYS as parameter 2:
define master_pass = &2
CONNECT IX/&ix_pass@orcl.world
execute dbms_aqadm.drop_aq_agent(agent_name=>'bob');
execute dbms_aqadm.drop_aq_agent(agent_name=>'guest');
execute dbms_aqadm.drop_aq_agent(agent_name=>'jane');
REM Allows access to the queues via the servlets
execute dbms_aqadm.create_aq_agent(agent_name=>'bob', enable_http =>true);
execute dbms_aqadm.create_aq_agent(agent_name=>'guest', enable_http =>true);
execute dbms_aqadm.create_aq_agent(agent_name=>'jane', enable_http =>true);
execute dbms_aqadm.enable_db_access('bob', 'IX');
execute dbms_aqadm.enable_db_access('jane', 'IX');
execute dbms_aqadm.enable_db_access('guest', 'IX');
REM make sure that ix already has aq_user_role and excecute on dbms_aq
CONNECT system/&master_pass@orcl.world as sysdba;
alter user ix grant connect through ix;


 

Enqueue a Message from the Internet

The easiest way to enqueue a message over the internet is to use XML. You will use an HTML form to generate the XML and then submit the XML to a java servlet that will enqueue the message into the orders_queue. Perform the following steps:

1.

Start your HTTP Server from Services or select Start > Program > Oracle - OraHome92 > Oracle HTTP Server > Start Oracle HTTP Server powered by Apache.

 
2.

From a browser window, enter the following URL:

http://<hostname>:7778/orders/OrderForm.html
 
3.

Make sure New Order is selected from the drop down list box, enter 101 for the CustomerId and click Generate XML.

 

4.

The generated XML will enqueue a message into the orders_queue when the order is submitted. Click Submit Order.

 

5.

You will need to login as one of the users in the aqpasswd file you created previously. Enter bob for User Name and welcome for Password and click OK.

 

6.

The message has been enqueued into the orders_queue and the message_id is shown.


7.

To see what is actually in the queue, open a SQL*Plus session logged on as IX and execute the following script:

@aq_show_queuetable

You can see that 3 messages have been enqueued.

 

Dequeue a Message from the Internet

To dequeue the message you will generate the XML that will dequeue the message from the orders_queue. Perform the following steps:

1.

Click Back to return to the Customer Order Form.

 
2.

Select Remove Order is selected from the drop down list box, enter 101 for the CustomerId and click Generate XML. The generated XML will dequeue a message from the orders_queue when the order is submitted. Click Submit Order.

 

3.

The order has been dequeued and the result is as follows:

 

4.

Switch to your SQL*Plus session and run the following script again to see that the SHIPPING consumer name message has been processed.

@aq_show_queuetable

 

5.

You can also dequeue the BILLING order by clicking Back, change the consumer name to BILLING and click Submit Order.

 

6.

Wait a few seconds and re-execute aq_show_queuetable in SQL*Plus to see that you now have no records in the queue.

 

 

Enqueuing a Message with a Transform from the Internet

You notice that the customer's first name and last name are currently null in the queue. You will run the transform during the enqueue that you created in the Integration with Advanced Queuing lesson. Perform the following steps:

1.

Click Back to return to the Customer Order Form.

 
2.

Make sure New Order is selected from the drop down list box, enter 101 for the CustomerId and click Generate XML. The generated XML will enqueue a message into the orders_queue when the order is submitted. In this case you also want the CUSTOMERVERIFY transformation to select the customer's first name and last name to verify that they are a valid customer. Enter the following statement right after the destination parameter in the producer_options section.

<transformation>IX.CUSTOMERVERIFY</transformation>

Then click Submit Order.

 

3.

The order has been enqueued and the message_id displayed.

 

4.

Switch to your SQL*Plus session and run the following script again:

@aq_show_queuetable

You notice that the customer first name and last name are enqueued as a result of the transform that was executed.

 

5.

You can now dequeue the message you transformed. Click Back to return to the Customer Order Form. Select Remove Order from the drop down list box, enter 101 in the CustomerId field and click Generate XML then click Submit Order.

 

6.

You see that the customer first name and last name are now included in the generated XML.

 

7.

Switch to your SQL*Plus session one more time and run the following script again:

@aq_show_queuetable

You notice that the SHIPPING message has now been processed.

 

 

Module Summary

In this module, you should have learned how to:

Setup the Internet Access to AQ environment

Run an enqueue from the internet
Run a dequeue from the internet
Verify the existance of a customer using a transformation

 

 

Copyright © 2002 Oracle Corporation. All Rights Reserved.

 

Close Window

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy