Tuesday 9 May 2017

Oracle Advanced Queuing

What Is Advanced Queuing?


When Web-based business applications communicate with each other, producer applications enqueue messages and consumer applications dequeue messages. Advanced Queuing provides database-integrated message queuing functionality. Advanced Queuing leverages the functions of the Oracle database so that messages can be stored persistently, propagated between queues on different machines and databases, and transmitted using Oracle Net Services, HTTP(S), and SMTP.

Since Oracle Advanced Queuing is implemented in database tables, all the operational benefits of high availability, scalability, and reliability are applicable to queue data. Standard database features such as recovery, restart, and security are supported in Advanced Queuing, and queue tables can be imported and exported.


Advanced Queuing in Integrated Application Environments

Advanced Queuing provides the message management functionality and asynchronous communication needed for application integration. In an integrated environment, messages travel between the Oracle database server and the applications and users.

Using Oracle Net Services, messages are exchanged between a client and the Oracle database server or between two Oracle databases. Oracle Net Services also propagates messages from one Oracle queue to another.

You can perform Advanced Queuing operations over the Internet using transport protocols such as HTTP, HTTPS, or SMTP. 


Interfaces to Advanced Queuing

You can access Advanced Queuing functionality through the following interfaces:
  • PL/SQL using DBMS_AQDBMS_AQADM, and DBMS_AQELM.
  • Visual Basic using Oracle Objects for OLE. Refer to the Online Help for Oracle Objects for OLE.
  • Java using the oracle.AQ Java package. 
  • Java Message Service (JMS) using the oracle.jms Java package.
  • Internet access using HTTP, HTTPS, and SMTP.

SQL Script to create the AQ table & Message Type


CREATE USER aq_user IDENTIFIED BY aq_user
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp;


ALTER USER aq_user QUOTA UNLIMITED ON users;


EXECUTE dbms_aqadm.grant_type_access ('aq_user');

CREATE TYPE message_type AS OBJECT (message_id NUMBER (15),subject VARCHAR2(100),text VARCHAR2(100),dollarvalue NUMBER(4,2));


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;



SQL Script to stop and drop the Queue

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');
 
DROP TYPE aq_user.message_type;
 


Configuring AQ adapter in Weblogic Console

1.Create a generic JDBC data source for the user you have created previously.

2.Create a outbound connection pool eis/aq/myQueue in AQ adapter.

Once it is done we can start creating the application using AQ adapter in SOA.


How to Create SOA Application Using AQ Adapter

You can refer to the below link to create an SOA application to perform the Enqueue operation in AQ adapter.


http://askmesoa.blogspot.in/2012/09/working-with-aq-adapter-in-soa.html


Incase if there has been any doubt in creating SOA application with AQ adapter.You can post your doubts in the comments sections.







No comments:

Post a Comment