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.







Thursday 4 May 2017

JMS

JMS (Java Message Service) is an API that provides the facility to create, send and read messages. It provides loosely coupled, reliable and asynchronous communication.

JMS is also known as a messaging service.

Requirement of JMS

Generally, user sends message to application. But, if we want to send message from one application to another, we need to use JMS API.

Consider a scenario, one application A is running in INDIA and another application B is running in USA. To send message from A application to B, we need to use JMS.

Messaging Domains

There are two types of messaging domains in JMS.

1)Point-to-Point Messaging Domain

2)Publisher/Subscriber Messaging Domain

1) Point-to-Point (PTP) Messaging Domain

In PTP model, one message is delivered to one receiver only. Here, Queue is used as a message oriented middleware (MOM).

The Queue is responsible to hold the message until receiver is ready.

In PTP model, there is no timing dependency between sender and receiver.



2) Publisher/Subscriber (Pub/Sub) Messaging Domain

In Pub/Sub model, one message is delivered to all the subscribers. It is like broadcasting. Here, Topic is used as a message oriented middleware that is responsible to hold and deliver messages.

In PTP model, there is timing dependency between publisher and subscriber.

JMS Programming Model
























How to use the JMS Adapter in SOA 12c



Oracle JCA Adapter for JMS (Oracle JMS Adapter), which enables an Oracle BPEL process or an Oracle Mediator component to interact with Java Messaging Service.

Configuring JMS Resources for JMSAdapter in Oracle SOA



Before building the applications using JMS adapter we have to configure the JMS rescouces for the JMS adapter in the weblogic console.

You can refer the below link to get the steo by step process to configure the JMS adapter

http://www.soatutor.com/2013/07/configuring-jms-resources-for-jmsadapter.html

How to build the application using JMS adapter in Oracle SOA



You can refer the below link to build a sample application using JMS adapter to consume and produce a message

http://learn-oraclesoa.blogspot.in/2013/04/oracle-jms-adapter-tutorial.html



If you have any doubt in configuration or builiding the application you can ask your doubt in the comments section.