Advanced Queueing: Asynchronous Notification callback not working for type AQ$_JMS_TEXT_MESSAGE. [message #223892] |
Mon, 12 March 2007 03:44 |
rahul_roz
Messages: 2 Registered: March 2007
|
Junior Member |
|
|
Hi All,
For Advanced Queueing, Asynchronous Notification callback not working for type AQ$_JMS_TEXT_MESSAGE. I tried using it with ADT which works fine. For the AQ$_JMS_TEXT_MESSAGE enqueing is working but not dequeing, no error visible.
Help needed! Is this is not supported, please guide.
I am calling the jmstext_enqueue procedure with agent 'myagent' which is registered to callback procedure
jmstext_dequeue.
Following are the scripts.
-- Create Table
BEGIN
dbms_aqadm.create_queue_table(queue_table => 'mytable',
queue_payload_type => 'SYS.AQ$_JMS_TEXT_MESSAGE',
multiple_consumers=>TRUE);
END;
-- Create Queue
BEGIN
dbms_aqadm.create_queue( queue_name => 'myqueue',
queue_table => 'mytable' );
END;
-- Start Queue
BEGIN
dbms_aqadm.start_queue(queue_name=>'myqueue');
END;
--Enqueue Procedure
CREATE OR REPLACE PROCEDURE jmstext_enqueue(msg IN VARCHAR2)
AS
PRAGMA AUTONOMOUS_TRANSACTION;
enqueue_options dbms_aq.enqueue_options_t;
message_properties dbms_aq.message_properties_t;
message_handle RAW(16);
agent sys.aq$_agent := sys.aq$_agent('myagent', null, null);
message sys.aq$_jms_text_message;
recipients DBMS_AQ.aq$_recipient_list_t;
BEGIN
message := sys.aq$_jms_text_message.construct;
recipients(1) := sys.aq$_agent('myagent', NULL, NULL);
message_properties.recipient_list := recipients;
message.set_string_property('color', 'RED');
message.set_text(msg);
dbms_aq.enqueue(queue_name => 'myqueue',
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => message,
msgid => message_handle);
COMMIT;
END;
--Dequeue Procedure
CREATE OR REPLACE PROCEDURE jmstext_dequeue (context raw,
reginfo sys.aq$_reg_info,
descr sys.aq$_descriptor,
payload raw,
payloadl number)
as
dequeue_options dbms_aq.dequeue_options_t;
message_properties dbms_aq.message_properties_t;
message_handle RAW(16);
message sys.aq$_jms_text_message;
agent sys.aq$_agent;
BEGIN
dequeue_options.msgid := descr.msg_id;
dequeue_options.consumer_name := 'myagent';
dbms_aq.dequeue(queue_name => 'myqueue',
dequeue_options => dequeue_options,
message_properties => message_properties,
payload => message,
msgid => message_handle);
INSERT INTO output_table VALUES ('Deque done');
COMMIT;
END;
--Add Subscriber
BEGIN
dbms_aqadm.add_subscriber
( queue_name => 'MYQUEUE',
subscriber => sys.aq$_agent('myagent', NULL, NULL) );
END;
-- register callback
BEGIN
dbms_aq.register
( sys.aq$_reg_info_list (
sys.aq$_reg_info ('MYQUEUE:MYAGENT',
dbms_aq.namespace_aq,
'plsql://jmstext_dequeue',
HEXTORAW('FF')
)
),
1
);
END;
-- test the working
begin
jmstext_enqueue('bulls eye');
end;
select count(*) from mytable;// this shows increment of row by 1
select * from output_table;//does not show anything.
Regards
-Rahul
|
|
|
|