I'm trying to get callbacks for oracle streams to work on ORACLE XE. I'd like to be able to perform a demo of using JMS to fire a pl/sql procedure. There are a million other ways of doing this, I'm sure.
The idea is to enqueue a message and have the callback fire off. The call back is created using DBMS_AQ.REGISTER
All I seem to get is the messages in thetopic/queue, and they don't go anywhere, my procedure is not called.
I fixed up my XE instance to support JMS data types.
Below is the code that I've used so far. The aq_tm_processes value is 1 and the job_queue_processes is 10. I've called START_TIME_MANAGER for what that's worth.
I'm not getting an answer on OTN (suprise) so I saw this site and thought it might be of help.
I'm missing something or XE can't do this, any help appreciated.
grant connect, resource, aq_administrator_role to jmsuser identified by jmsuser; grant execute on sys.dbms_aqadm to jmsuser; grant execute on sys.dbms_aq to jmsuser; grant execute on sys.dbms_aqin to jmsuser; grant execute on sys.dbms_aqjms to jmsuser; exec dbms_aqadm.grant_system_privilege('ENQUEUE_ANY','jmsuser'); exec dbms_aqadm.grant_system_privilege('DEQUEUE_ANY','jmsuser'); CREATE ROLE my_aq_adm_role; grant connect, resource, aq_administrator_role to my_aq_adm_role; CREATE ROLE my_aq_user_role; GRANT aq_user_role to my_aq_user_role ; GRANT my_aq_user_role to jmsuser; dbms_aqadm.create_queue_table( queue_table => 'test_topic_table', comment => 'test topic_table', multiple_consumers => TRUE, compatible => '9.0.0', Queue_payload_type => 'SYS.AQ$_JMS_TEXT_MESSAGE', message_grouping => DBMS_AQADM.TRANSACTIONAL ); DBMS_AQADM.CREATE_QUEUE (Queue_name => 'jmsuser.test_topic', queue_type => DBMS_AQADM.NORMAL_QUEUE, max_retries => 3, retry_delay => 3, retention_time => 0, comment=>'test queue', auto_commit =>TRUE, Queue_table => 'jmsuser.test_topic_table'); DBMS_AQADM.START_QUEUE (Queue_name => 'jmsuser.test_topic'); DBMS_AQADM.ADD_SUBSCRIBER ( queue_name => 'test_topic', subscriber => SYS.AQ$_AGENT( 'test_topic_subscriber', 'jmsuser.test_topic', NULL ) ); DBMS_AQ.REGISTER ( SYS.AQ$_REG_INFO_LIST( SYS.AQ$_REG_INFO( 'test_topic:test_topic_subscriber', DBMS_AQ.NAMESPACE_AQ, 'plsql://JMSUSER.TOPIC_CALLBACK', HEXTORAW('FF') ) ), 1 ); create or replace PROCEDURE TOPIC_CALLBACK ( context RAW, regInfo SYS.AQ$_REG_INFO, descr SYS.AQ$_DESCRIPTOR, payload SYS.AQ$_JMS_TEXT_MESSAGE, -- payload raw, payload1 number ) AS r_dequeue_options DBMS_AQ.DEQUEUE_OPTIONS_T; r_message_properties DBMS_AQ.MESSAGE_PROPERTIES_T; v_message_handle RAW(16); my_info VARCHAR2(4000); o_payload SYS.AQ$_JMS_TEXT_MESSAGE; BEGIN r_dequeue_options.msgid := descr.msg_id; r_dequeue_options.consumer_name := descr.consumer_name; DBMS_AQ.DEQUEUE( queue_name => descr.queue_name, dequeue_options => r_dequeue_options, message_properties => r_message_properties, payload => o_payload, msgid => v_message_handle ); o_payload.get_text(my_info) ; INSERT INTO jmsuser.aq_info_table ( MESSAGE ) VALUES ( 'Message [' || trim(my_info) || '] ' || 'dequeued at [' || TO_CHAR( SYSTIMESTAMP, 'DD-MON-YYYY HH24:MI:SS.FF3' ) || ']' ); COMMIT; END TOPIC_CALLBACK;