Hi Tom,
I created a sample script to Enqueue and Dequeue Messages by Priority Using PL/SQL. I based it on the link you provided:
http://download-west.oracle.com/docs/cd/A87860_01/doc/appdev.817/a76938/adq_aex3.htm ----------------------------------
/* Enqueue two messages with priority 7 and 5: */
DECLARE
enqueue_options dbms_aq.enqueue_options_t;
message_properties dbms_aq.message_properties_t;
message_handle RAW(16);
message AQ_APPS_USR.message_typ;
BEGIN
message := message_typ('PRIORITY MESSAGE',
'Enqueued at priority 7.');
message_properties.priority := 7;
DBMS_AQ.ENQUEUE(queue_name => 'msg_queue',
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => message,
msgid => message_handle);
message := message_typ('PRIORITY MESSAGE',
'Enqueued at priority 5.');
message_properties.priority := 5;
DBMS_AQ.ENQUEUE(queue_name => 'msg_queue',
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => message,
msgid => message_handle);
END;
/* Dequeue from priority queue: */
DECLARE
dequeue_options DBMS_AQ.dequeue_options_t;
message_properties DBMS_AQ.message_properties_t;
message_handle RAW(16);
message AQ_APPS_USR.message_typ;
BEGIN
dequeue_options.navigation := DBMS_AQ.first_message;
DBMS_AQ.DEQUEUE(queue_name => 'msg_queue',
dequeue_options => dequeue_options,
message_properties => message_properties,
payload => message,
msgid => message_handle);
DBMS_OUTPUT.PUT_LINE ('Message: ' || message.subject ||
' ... ' || message.text );
COMMIT;
dequeue_options.navigation := DBMS_AQ.first_message;
DBMS_AQ.DEQUEUE(queue_name => 'msg_queue',
dequeue_options => dequeue_options,
message_properties => message_properties,
payload => message,
msgid => message_handle);
DBMS_OUTPUT.PUT_LINE ('Message: ' || message.subject ||
' ... ' || message.text );
COMMIT;
END;
----------------------------------
This is the output after running DBMS_AQ.DEQUEUE:
Message: PRIORITY MESSAGE ... Enqueued at priority 7.
Message: PRIORITY MESSAGE ... Enqueued at priority 5.
----------------------------------
I thought the expected output is that priority 5 should be displayed first. Can you enlighten me on this?
I'm not sure if this info is helpful to you:
SQL> SELECT compatible FROM dba_queue_tables WHERE owner = 'AQ_APPS_USR';
COMPATIBLE
----------
8.0.3
Thanks,
Rae