SOA 11g - AQ Adapter
Introduction to the Oracle AQ Adapter:
Oracle Streams Advanced Queuing (AQ) provides a flexible mechanism for
bidirectional, asynchronous communication between participating
applications. Advanced queues are an Oracle database feature, and are
therefore scalable and reliable. Other features of Oracle database, such
as backup and recovery (including any-point-in-time recovery), logging,
transactional services, and system management, are also inherited by
advanced queues. Multiple queues can also service a single application,
partitioning messages in a variety of ways and providing another level
of scalability through load balancing.
Oracle AQ Adapter Features:
- The Oracle AQ Adapter is both a producer and a consumer of AQ messages. The enqueue operation is exposed as a JCA outbound interaction. The dequeue operation is exposed as a JCA inbound interaction.
- The Oracle AQ Adapter supports ADT (Oracle object type),
XMLType
, andRAW
queues as payloads. It also supports extracting a payload from one ADT member column. - The Oracle AQ Adapter supports normalized properties for enqueue and dequeue operations.
· The Oracle AQ Adapter supports the following features of Oracle Streams AQ:
o Correlation Identifier
o Multiconsumer Queue
o Message Priority
o Time Specification and Scheduling and many more.
SQL Script to create the AQ table & Message Type:
SQL>CONNECT sys/change_on_install as sysdba
SQL>DROP USER aq_user CASCADE;
SQL>CREATE USER aq_user IDENTIFIED BY aq_user
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp;
SQL>ALTER USER aq_user QUOTA UNLIMITED ON users;
SQL>GRANT aq_administrator_role TO aq_user;
SQL>GRANT connect TO aq_user;
SQL>GRANT create type TO aq_user;
SQL>GRANT create sequence TO aq_user;
SQL>EXECUTE dbms_aqadm.grant_type_access ('aq_user');
-- Login as AQ_User
SQL>CONNECT aq_user/aq_user
SQL>CREATE TYPE message_type AS OBJECT (message_id NUMBER (15),subject VARCHAR2(100),text VARCHAR2(100),dollarvalue NUMBER(4,2));
SQL>BEGIN
-- ----------------------------------------------------
DBMS_AQADM.CREATE_QUEUE_TABLE (
queue_table => 'aq_user.msg_qt'
, queue_payload_type => 'aq_user.message_type'
);
-- ----------------------------------------------------
DBMS_AQADM.CREATE_QUEUE (
queue_name => 'msg_queue'
, queue_table => 'aq_user.msg_qt'
, queue_type => DBMS_AQADM.NORMAL_QUEUE
, max_retries => 0
, retry_delay => 0
, retention_time => 1209600
, dependency_tracking => FALSE
, comment => 'Test Object Type Queue'
, auto_commit => FALSE
);
-- ----------------------------------------------------
DBMS_AQADM.START_QUEUE ('msg_queue');
-- ----------------------------------------------------
END;
Script to Stop and Drop the Queue:
SQL>CONNECT aq_user/aq_user
EXECUTE dbms_aqadm.stop_queue (queue_name => 'aq_user.msg_queue');
EXECUTE dbms_aqadm.drop_queue (queue_name => 'aq_user.msg_queue');
EXECUTE
dbms_aqadm.drop_queue_table (queue_table => 'aq_user.msg_qt');
SQL>DROP TYPE aq_user.message_type;
No comments:
Post a Comment