Sep 10, 2012

How to do Setup of AQMQ? -- SCRIPTS

How to do Setup of AQMQ?  

--  SCRIPTS
Following are Main Tables involved in AQ-MQ Setup:

select * from mgw_gateway

select * from mgw_schedules      

select * from mgw_subscribers

select * from mgw_foreign_queues

select * from   mgw_links

select * from   MGW_MQSERIES_LINKS

select * from   MGW$_MQSERIES_LINKS

select * from   all_objects  where object_name like '%MG%LINK%'

-- Check MGW gateway Start or Not
select * from mgw_gateway

--=============================================
--Process of Removal of Setup
--=============================================
-- To Stop/Shutdown MGWgateway
begin
dbms_mgwadm.shutdown;
end;

-- To Remove UNSCHEDULE PROPAGATION
BEGIN
   DBMS_MGWADM.UNSCHEDULE_PROPAGATION(
   schedule_id      => 'XXAPPL_EAI_AQ2MQ_SCH'); 
END;


begin
DBMS_MGWADM.UNSCHEDULE_PROPAGATION (
   schedule_id   => 'XXAPPL_EAI_MQ2AQ_SCH');
end;


-- To Remove SUBSCRIBER
begin
DBMS_MGWADM.REMOVE_SUBSCRIBER (
   subscriber_id  => 'XXAPPL_EAI_AQ2MQ_SUB',
   force        => 1 );
end;

begin
DBMS_MGWADM.REMOVE_SUBSCRIBER (
   subscriber_id  => 'XXAPPL_EAI_AQ2MQ_SUB',
   force        => 1 );
end;


--- Unregister  Foriegn Q: Registration Request Queue

begin
DBMS_MGWADM.UNREGISTER_FOREIGN_QUEUE(
   name           =>'XXAPPL_EAI_REQ_QUEUE',
   linkname       =>'XXAPPL_EAI_AQ_MQ_LINK' );
 end;

--- Unregister  Foriegn Q: Registration Response Queue
 begin
DBMS_MGWADM.UNREGISTER_FOREIGN_QUEUE(
   name           => 'XXAPPL_EAI_RESP_QUEUE',
   linkname       => 'XXAPPL_EAI_AQ_MQ_LINK');
 end;
---

-- Remove the Old MGW Link
  begin
       DBMS_MGWADM.REMOVE_MSGSYSTEM_LINK(
   linkname   => 'XXAPPL_EAI_AQ_MQ_LINK');
  end;
--

--=============================================
--Process of Creation of  new Objects
--=============================================

--- Create MGW Link
DECLARE
   v_options   SYS.mgw_properties;
   v_prop      SYS.mgw_mqseries_properties;
BEGIN
   v_prop := SYS.mgw_mqseries_properties.construct ();
   v_prop.max_connections := 1;
   v_prop.queue_manager := 'QXXGP1';
   v_prop.hostname := '10.87.130.121';
   v_prop.channel := 'QMEIGP1.XXAPPL.SVRCONN';
   v_prop.port := '6111';
   v_prop.outbound_log_queue := 'IXXAPPL.AQMQ.UPE.OUT';
   v_prop.inbound_log_queue := 'IXXAPPL.AQMQ.UPE.IN';
   DBMS_MGWADM.create_msgsystem_link
                          (linkname        => 'XXAPPL_EAI_AQ_MQ_LINK', -- link name
                           properties      => v_prop,               -- mqseries driver properties
                           options         => v_options             -- options
                          );                                       
END;

--======================================================

---  Register Foriegn Que :  Registration Request Queue 
DECLARE
   v_options   SYS.mgw_properties;
BEGIN
   v_options :=
             SYS.mgw_properties (SYS.mgw_property ('MQ_openOptions', '2048'));
   DBMS_MGWADM.register_foreign_queue
      (NAME                => 'XXAPPL_EAI_REQ_QUEUE',              -- MGW foreign queue name
       linkname            => 'XXAPPL_EAI_AQ_MQ_LINK',             -- name of link to use
       provider_queue  => RTRIM ('IXXAPPL.CMS.WRITEBSCS.01'),  -- name of MQSeries queue
       domain              => DBMS_MGWADM.domain_queue,     -- single consumer queue
       options             => v_options
      );
END;


--  Register Foriegn Que: Registration Response Queue
DECLARE
   v_options   SYS.mgw_properties;
BEGIN
   v_options :=
             SYS.mgw_properties (SYS.mgw_property ('MQ_openOptions', '2066'));
   DBMS_MGWADM.register_foreign_queue
      (NAME                => 'XXAPPL_EAI_RESP_QUEUE',     -- MGW foreign queue name
       linkname            => 'XXAPPL_EAI_AQ_MQ_LINK',     -- name of link to use
       provider_queue  => RTRIM ('CMS.IXXAPPL.WRITEBSCS.UPE.01'),   -- name of MQSeries queue
       domain              => DBMS_MGWADM.domain_queue,   -- single consumer queue
       options             => v_options
      );
END;
---
--Execute following script to check.
select name, link_name, provider_queue from MGW_FOREIGN_QUEUES
  where NAME='XXAPPL_EAI_RESP_QUEUE'

--====================================================================

-- Add subscription for Request  Queue
BEGIN
   DBMS_MGWADM.add_subscriber
                 (subscriber_id         => 'XXAPPL_EAI_AQ2MQ_SUB',                    -- MGW subscriber name
                  propagation_type      => DBMS_MGWADM.outbound_propagation,
                  queue_name            => 'AQADMIN.XXAPPL_REQUEST_QUE_EAI',
                  destination           => 'XXAPPL_EAI_REQ_QUEUE@XXAPPL_EAI_AQ_MQ_LINK');
                                                 
END;

--- Subscription for Response Queue
BEGIN
   DBMS_MGWADM.add_subscriber
                        (subscriber_id         => 'XXAPPL_EAI_MQ2AQ_SUB',
                         propagation_type      => DBMS_MGWADM.inbound_propagation,
                         queue_name            => 'XXAPPL_EAI_RESP_QUEUE@XXAPPL_EAI_AQ_MQ_LINK',
                         destination           => 'AQADMIN.XXAPPL_RESPONSE_QUE_EAI'
                        );
END;

--Execute following script to check.
select subscriber_id,queue_name,destination,exception_queue from mgw_subscribers
 where SUBSCRIBER_ID='XXAPPL_EAI_MQ2AQ_SUB'

--====================================================================

 --- Schedule Propogation for Request Queue
BEGIN
   DBMS_MGWADM.schedule_propagation
                       (schedule_id           => 'XXAPPL_EAI_AQ2MQ_SCH',
                        propagation_type      =>  DBMS_MGWADM.outbound_propagation,
                        SOURCE                => 'AQADMIN.XXAPPL_REQUEST_QUE_EAI',
                        destination           => 'XXAPPL_EAI_REQ_QUEUE@XXAPPL_EAI_AQ_MQ_LINK'
                       );
END;

--  Schedule Propogation for Response Queue

BEGIN
   DBMS_MGWADM.schedule_propagation
                        (schedule_id           => 'XXAPPL_EAI_MQ2AQ_SCH',
                         propagation_type      => DBMS_MGWADM.inbound_propagation,
                         SOURCE                => 'XXAPPL_EAI_RESP_QUEUE@XXAPPL_EAI_AQ_MQ_LINK',
                         destination           => 'AQADMIN.XXAPPL_RESPONSE_QUE_EAI'
                        );
END;
--Execute following script to check.
select schedule_id,source, destination from mgw_schedules

--====================================================================

-- Enable propogations
  BEGIN
    DBMS_MGWADM.ENABLE_PROPAGATION_SCHEDULE('XXAPPL_EAI_AQ2MQ_SCH');
  END;

    BEGIN
    DBMS_MGWADM.ENABLE_PROPAGATION_SCHEDULE('XXAPPL_EAI_MQ2AQ_SCH');
    END;

--====================================================================  
--Now Start MGWGateway
     
    begin
    dbms_mgwadm.startup;
    end;
 
Confirm in the following table

select LINK_NAME, QUEUE_MANAGER, HOSTNAME, PORT, CHANNEL from mgw_mqseries_links;

select name, link_name, provider_queue from MGW_FOREIGN_QUEUES

select subscriber_id,queue_name,destination,exception_queue from mgw_subscribers;

select  *  from mgw_schedules;


Done

******************All the best with Setups******************

No comments:

OraApps Search

Custom Search

Search This Blog