Oracle Application Server InterConnect Adapter for AQ Installation and User's Guide 10g (9.0.4) Part Number B10416-01 |
|
This chapter describes sample use cases for the Advanced Queuing adapter.
The following are sample use cases for the Advanced Queuing adapter.
The Advanced Queuing adapter publishes and subscribes using RAW Payload. The following case uses one installation of an Advanced Queuing adapter that publishes a message and subscribes to the same event. Therefore, the log files will indicate that an outbound message is followed by an inbound message.
Using SQL*PLUS utility, run the following script to create the application user:
connect system/manager create user aquser identified by manager; grant connect, resource to aquser; grant aq_user_role, aq_administrator_role to aquser;
The following steps describe the procedures necessary to publish and subscribe a message containing RAW XML payload. The event created is createCustomer
where the payload corresponds to the customer.dtd
provided. For outbound messages, the application queues are xml_raw_q1
. For inbound messages, the application queues are xml_raw_q2
.
The following steps describe the runtime procedures necessary to publish and subscribe a message containing RAW XML payload.
aquser
by running the create_user.sql
script in SQL*PLUS. Log in as the system user.
aquser/manager
using the SQL*PLUS utility.
CreateAQ.sql
script.
EnqCust.sql
script.
agent_log_level
parameter to 2 in the adapter.ini
file.
xml_raw_q2
by viewing the log files in the log directory of the Advanced Queuing adapter.
The following files are related to the steps in case one.
customer.dtd <!ELEMENT customer (id,name,address*)> <!ELEMENT address (city, state)> <!ELEMENT city (#PCDATA)> <!ELEMENT state (#PCDATA)> <!ELEMENT name (#PCDATA)> <!ELEMENT id (#PCDATA)>
xml_raw_q1
, xml_raw_q2
:
CreateAQ.sql EXECUTE dbms_aqadm.create_queue_table (queue_table => 'RawMsgs_qtab', queue_ payload_type => 'RAW', multiple_consumers => FALSE); EXECUTE dbms_aqadm.create_queue (queue_name => 'xml_raw_q1', queue_table => 'RawMsgs_qtab'); EXECUTE dbms_aqadm.start_queue (queue_name => 'xml_raw_q1'); EXECUTE dbms_aqadm.create_queue (queue_name => 'xml_raw_q2', queue_table => 'RawMsgs_qtab'); EXECUTE dbms_aqadm.start_queue (queue_name => 'xml_raw_q2');
createCustomer
event on xml_raw_q1 queue
:
EnqCust.sql DECLARE enqueue_options dbms_aq.enqueue_options_t; message_properties dbms_aq.message_properties_t; msgid RAW(16); payload RAW(5000); BEGIN payload := utl_raw.cast_to_raw('<?xml version="1.0" standalone="no"?> <customer><id>10</id> <name>Herb Stiel</name> <address> <city>SanMateo</city> <state>California</state> </address> </customer>'); dbms_aq.enqueue(queue_name => 'xml_raw_q1', enqueue_options => enqueue_options, message_properties => message_properties, payload => payload, msgid => msgid); COMMIT; END; /
CREATE USER aquser IDENTIFIED BY manager; GRANT CONNECT, RESOURCE TO aquser; GRANT AQ_USER_ROLE, AQ_ADMINISTRATOR_ROLE TO aquser;
The Advanced Queuing adapter invokes and implements with Oracle Object Type Payload. This case uses one installation of an Advanced Queuing adapter that sends a request, receives the request, sends back a reply, and receives the reply. Therefore, the log files will indicate four different message entries.
The following steps describe the procedures necessary to invoke and implement a procedure. An Oracle Object Type is used as a payload.
aquser/manager
using the SQL*PLUS utility.
CreateADT.sql
file.
CreateADTQueue.sql
script.
The following steps describe the runtime procedures that implements and invokes a procedure with Oracle Object Type payload.
EnqueueADT.sql
script to enqueue an XML message.
agent_log_level
parameter to 2 in the adapter.ini
file.
The following files are related to the runtime steps in case two.
CreateADT.sql
CREATE TYPE my_queue_type as object(id number, payload varchar2(1000)); /
CreateADTQueue.sql
EXECUTE dbms_aqadm.create_queue_table (queue_table => 'ADTMsgs_qtab', queue_ payload_type => 'my_queue_type', multiple_consumers => FALSE); EXECUTE dbms_aqadm.create_queue (queue_name => 'xml_q1', queue_table => 'ADTMsgs_qtab'); EXECUTE dbms_aqadm.start_queue (queue_name => 'xml_q1'); EXECUTE dbms_aqadm.create_queue (queue_name => 'xml_q2', queue_table => 'ADTMsgs_qtab'); EXECUTE dbms_aqadm.start_queue (queue_name => 'xml_q2'); EXECUTE dbms_aqadm.create_queue (queue_name => 'xml_q3', queue_table => 'ADTMsgs_qtab'); EXECUTE dbms_aqadm.start_queue (queue_name => 'xml_q3');
EnqueueADT.sql
DECLARE enqueue_options dbms_aq.enqueue_options_t; message_properties dbms_aq.message_properties_t; msgid RAW(16); payload cust; BEGIN payload := my_queue_type(123, '<customer><id>10</id> <name>Herb Stiel</name> <address> <city>SanMateo</city> <state>California</state> </address> </customer>'); dbms_aq.enqueue(queue_name => 'xml_q1', enqueue_options => enqueue_options, message_properties => message_properties, payload => payload, msgid => msgid); COMMIT; END; /
|
![]() Copyright © 2002, 2003 Oracle Corporation. All Rights Reserved. |
|