Rem drv: <create type="types"/>
Rem
Rem $Header: emcore/source/oracle/sysman/emdrep/sql/core/latest/adminmsg/adminmsg_bus_types.sql rbali_oneoff_updated/1 2025/03/14 06:41:14 rbali Exp $
Rem
Rem adminmsg_bus_types.sql
Rem
Rem Copyright (c) 2007, 2025, Oracle and/or its affiliates. 
Rem All rights reserved.

Rem BEGIN EMRU_FILE_METADATA
Rem EMRU_SOURCE_FILE:emcore/source/oracle/sysman/emdrep/sql/core/latest/adminmsg/adminmsg_bus_types.sql
Rem EMRU_UNIX_DELIVERABLES:
Rem emcore/source/oracle/sysman/emdrep/sql/core/latest/adminmsg/adminmsg_bus_types.sql

Rem EMRU_FILE_POSTINSTALL:<!!! enter the view based location of the executable file. If there is NONE leave as-is !!!>
Rem EMRU_GENERIC_FLAG:NONE
Rem END EMRU_FILE_METADATA

Rem
Rem    NAME
Rem      adminmsg_bus_types.sql - <one-line expansion of the name>
Rem
Rem    DESCRIPTION
Rem      <short description of component this file declares/defines>
Rem
Rem    NOTES
Rem      <other useful comments, qualifications, etc.>
Rem
Rem    MODIFIED   (MM/DD/YY)
Rem    gbafna      02/03/25 - 
Rem    gbafna      01/07/25 - make synonyms noneditionable
Rem    njagathe    06/23/15 - Move from DATE to TIMESTAMP columns
Rem    rnadidar    02/11/15 - cut over to EBR
Rem    srpuluku    04/01/13 - Bug Fix for 16449040
Rem    neearora    05/04/07 - Created
Rem

ALTER SESSION SET CURRENT_SCHEMA=SYSMAN_TYPES;

CREATE OR REPLACE TYPE MGMT_ADMINMSG_NAMEVAL_OBJ AS OBJECT
(
  name VARCHAR2(256),
  value VARCHAR2(4000)
)
/

grant execute on MGMT_ADMINMSG_NAMEVAL_OBJ to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('MGMT_ADMINMSG_NAMEVAL_OBJ');
END;
/

CREATE OR REPLACE TYPE MGMT_ADMINMSG_NAMEVAL_ARRAY AS
VARRAY(200) OF MGMT_ADMINMSG_NAMEVAL_OBJ
/

grant execute on MGMT_ADMINMSG_NAMEVAL_ARRAY to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('MGMT_ADMINMSG_NAMEVAL_ARRAY');
END;
/

CREATE OR REPLACE TYPE MGMT_ADMIN_MSG AS OBJECT
(
  message_type       VARCHAR2(32), -- adminmsg type name
  operation_type     NUMBER(2),  -- message_type specific operation type

  -- internal book-keeping fields
  msg_broadcast_time DATE,
  msg_deq_time       DATE,
  
  -- parameters specific to message_type and operation_type
  params             MGMT_ADMINMSG_NAMEVAL_ARRAY,  
  CONSTRUCTOR FUNCTION MGMT_ADMIN_MSG
  (
    p_message_type   IN VARCHAR2,
    p_operation_type IN NUMBER DEFAULT NULL,
    p_params         IN MGMT_ADMINMSG_NAMEVAL_ARRAY DEFAULT NULL
  )
  RETURN SELF AS RESULT
);
/

grant execute on MGMT_ADMIN_MSG to sysman;

BEGIN
    SYSMAN.CUTOVER_SYNONYM('MGMT_ADMIN_MSG');
END;
/

ALTER SESSION SET CURRENT_SCHEMA=SYSMAN;

-- Create and start the Cache Bus Queue
BEGIN
  DBMS_AQADM.CREATE_QUEUE_TABLE (queue_table => '&&EM_REPOS_USER'||'.MGMT_ADMINMSG_BUS',
                               queue_payload_type => '&&EM_REPOS_USER'||'_TYPES.MGMT_ADMIN_MSG',
                               multiple_consumers => TRUE);
  
  DBMS_AQADM.CREATE_QUEUE (queue_name => '&&EM_REPOS_USER'||'.MGMT_ADMINMSG_BUS',
                           queue_table => '&&EM_REPOS_USER'||'.MGMT_ADMINMSG_BUS');
  
  DBMS_AQADM.START_QUEUE (queue_name => '&&EM_REPOS_USER'||'.MGMT_ADMINMSG_BUS');
END;
/
@@&&EM_SQL_ROOT/core/12.1.0.3/adminmsg/adminmsg_bus_types_upgrade.sql
@@&&EM_SQL_ROOT/core/12.2.0.0/adminmsg/adminmsg_bus_types_upgrade.sql
@@&&EM_SQL_ROOT/core/13.1.0.0/adminmsg/adminmsg_bus_types_upgrade.sql

