Enqueuing Application Message in Oracle
Creating a Queue Table and Queue of Object Type
/* Creating a message type: */
CREATE type aq.Message_typ as object (
subject VARCHAR2(30),
text VARCHAR2(80));
/* Creating a object type queue table and queue: */
EXECUTE DBMS_AQADM.CREATE_QUEUE_TABLE (
queue_table => 'aq.objmsgs80_qtab',
queue_payload_type => 'aq.Message_typ');
EXECUTE DBMS_AQADM.CREATE_QUEUE (
queue_name => 'msg_queue',
queue_table => 'aq.objmsgs80_qtab');
EXECUTE DBMS_AQADM.START_QUEUE (
queue_name => 'msg_queue');
Creating a Queue Table and Queue of Raw Type
/* Creating a RAW type queue table and queue: */
EXECUTE DBMS_AQADM.CREATE_QUEUE_TABLE (
queue_table => 'aq.RawMsgs_qtab',
queue_payload_type => 'RAW');
EXECUTE DBMS_AQADM.CREATE_QUEUE (
queue_name => 'raw_msg_queue',
queue_table => 'aq.RawMsgs_qtab');
EXECUTE DBMS_AQADM.START_QUEUE (
queue_name => 'raw_msg_queue');
Creating Prioritized Message Queue Table and Queue
EXECUTE DBMS_AQADM.CREATE_QUEUE_TABLE (
queue_table => 'aq.priority_msg',
sort_list => 'PRIORITY,ENQ_TIME',
queue_payload_type => 'aq.Message_typ');
EXECUTE DBMS_AQADM.CREATE_QUEUE (
queue_name => 'priority_msg_queue',
queue_table => 'aq.priority_msg');
EXECUTE DBMS_AQADM.START_QUEUE (
queue_name => 'priority_msg_queue');
Creating a Multiconsumer Queue Table and Queue
EXECUTE DBMS_AQADM.CREATE_QUEUE_TABLE (
queue_table => 'aq.MultiConsumerMsgs_qtab',
multiple_consumers => TRUE,
queue_payload_type => 'aq.Message_typ');
EXECUTE DBMS_AQADM.CREATE_QUEUE (
queue_name => 'msg_queue_multiple',
queue_table => 'aq.MultiConsumerMsgs_qtab');
EXECUTE DBMS_AQADM.START_QUEUE (
queue_name => 'msg_queue_multiple');
Creating a Queue to Demonstrate Propagation
EXECUTE DBMS_AQADM.CREATE_QUEUE (
queue_name => 'another_msg_queue',
queue_table => 'aq.MultiConsumerMsgs_qtab');
EXECUTE DBMS_AQADM.START_QUEUE (
queue_name => 'another_msg_queue');