enqueue dequeue sql script

Enqueue Message

DECLARE
enqueue_options DBMS_AQ.enqueue_options_t;
message_properties DBMS_AQ.message_properties_t;
msg_handle RAW (16);
ipmsg ip_message_type;
xml_clob CLOB;
msg_id NUMBER (10);
subscribers DBMS_AQ.aq$_recipient_list_t;
BEGIN
xml_clob := '';
subscribers (1) :=
SYS.aq$_agent (''
, NULL
, NULL);
message_properties.recipient_list := subscribers;
DBMS_AQ.enqueue (queue_name => ''
, enqueue_options => enqueue_options
, message_properties => message_properties
, payload => xml_clob
, msgid => msg_handle);
COMMIT;
END;

Dequeue Message

DECLARE
dequeue_options DBMS_AQ.dequeue_options_t;
message_properties DBMS_AQ.message_properties_t;
message_handle RAW (16);
xml_clob CLOB;
BEGIN
dequeue_options.consumer_name := '';
dequeue_options.dequeue_mode := DBMS_AQ.remove;
-- Only if you want to remove message
dequeue_options.navigation := DBMS_AQ.next_message;
dequeue_options.WAIT := DBMS_AQ.forever;
DBMS_AQ.dequeue (queue_name => ''
, dequeue_options => dequeue_options
, message_properties => message_properties
, payload => xml_clob
, msgid => message_handle);
DBMS_OUTPUT.PUT_LINE ('Message ID : ' xml_clob);
COMMIT;
END;

Comments

Popular posts from this blog

ORA-44412: XE edition memory parameter invalid or not specified

How to mount a WD Book Live as NFS in OEL6U3

BPEL Engine Exceptions ORABPEL 02000 - 02179