Search This Blog

Friday, October 18, 2013

Create SOA related Queues

 

-- Drop and create IP_IN_QUEUE related queue tables , queues etc
begin
dbms_aqadm.stop_queue (queue_name => 'IP_IN_QUEUE');
dbms_aqadm.drop_queue (queue_name => 'IP_IN_QUEUE');
dbms_aqadm.stop_queue (queue_name => 'IP_OUT_QUEUE');
dbms_aqadm.drop_queue (queue_name => 'IP_OUT_QUEUE');
dbms_aqadm.drop_queue_table (queue_table => 'IP_QTAB');
end;
 
BEGIN
   dbms_aqadm.create_queue_table (queue_table => 'IP_QTAB', queue_payload_type =>  'IP_MESSAGE_TYPE', multiple_consumers => TRUE);
   dbms_aqadm.create_queue (queue_name =>  'IP_IN_QUEUE', queue_table =>  'IP_QTAB');
   dbms_aqadm.create_queue (queue_name => 'IP_OUT_QUEUE', queue_table => 'IP_QTAB');
   dbms_aqadm.start_queue(queue_name => 'IP_IN_QUEUE', dequeue => TRUE, enqueue => TRUE);
   dbms_aqadm.start_queue(queue_name =>  'IP_OUT_QUEUE', dequeue => TRUE, enqueue => TRUE);
END;

-- Drop and create  edn_event_queue related related queue tables , queues etc and subscribers

begin
  DBMS_AQADM.stop_queue(queue_name=>'edn_event_queue');
  DBMS_AQADM.drop_queue(queue_name=>'edn_event_queue');
  DBMS_AQADM.drop_queue_table(queue_table=>'edn_event_queue_table');
end;

begin
  DBMS_AQADM.create_queue_table(
    queue_table         => 'edn_event_queue_table',
    queue_payload_type  => 'EDN_EVENT_DATA',
    multiple_consumers  => TRUE);
   
  DBMS_AQADM.create_queue(
    queue_name          => 'edn_event_queue',
    queue_table         => 'edn_event_queue_table');
  DBMS_AQADM.start_queue(queue_name=>'edn_event_queue');
end;

REM  Register Fabric subscriber
declare
  sub sys.aq$_agent;
begin
  sub := sys.aq$_agent('edn_java_subscriber', NULL, NULL);
  DBMS_AQADM.add_subscriber(queue_name=>'edn_event_queue', subscriber=>sub);
end;

REM  Register SQL subscriber
declare
  sub sys.aq$_agent;
begin
  sub := sys.aq$_agent('edn_sql_subscriber', NULL, NULL);
  DBMS_AQADM.add_subscriber(queue_name=>'edn_event_queue', subscriber=>sub);
end;

--  Drop and create  edn_oaoo_queue related related queue tables , queues etc and subscribers

begin
  DBMS_AQADM.stop_queue(queue_name=>'edn_oaoo_queue');
  DBMS_AQADM.drop_queue(queue_name=>'edn_oaoo_queue');
  DBMS_AQADM.drop_queue_table(queue_table=>'edn_oaoo_delivery_table');
end;
/

begin
  DBMS_AQADM.create_queue_table(
    queue_table         => 'edn_oaoo_delivery_table',
    queue_payload_type  => 'edn_oaoo_delivery',
    multiple_consumers  => TRUE);
  DBMS_AQADM.create_queue(
    queue_name          => 'edn_oaoo_queue',
    queue_table         => 'edn_oaoo_delivery_table');
  DBMS_AQADM.start_queue(queue_name=>'edn_oaoo_queue');
end;


declare
  sub sys.aq$_agent;
begin
  sub := sys.aq$_agent('edn_oaoo_subscriber', NULL, NULL);
  DBMS_AQADM.add_subscriber(queue_name=>'edn_oaoo_queue', subscriber=>sub);
end;

No comments: