When we try to enqueue messages on this queue now, we receive an ORA-24033: no recipients for message. This means we need to set up subscribers first. If we enqueue without a recipient list, the message will be made available for all subscribers.
To add a subscriber, we use the dbms_aqadm package and a new object_type: sys.aq$_agent.
This type is defined as an object of name , address and protocol. The last 2 are used in inter-system communication only.
We can just call the following procedure:
DECLARE
V_agent sys.aq$_agent;
BEGIN
V_agent:= sys.aq$_agent('Agent1',NULL,NULL);
DBMS_AQADM.ADD_SUBSCRIBER(queue_name=>'xxx_mc_test_q'
,subscriber=>v_agent);
END;
We can see the subscribers from the view aq$xxx_mc_test_s (or the underlying table: aq$_xxx_mc_test_s):
select * from aq$xxx_mc_test_s;
QUEUE NAME ADDRESS PROTOCOL TRANSFORMATION
————– —— ——- ——– ————–
XXX_MC_TEST_Q AGENT1 0
参考: http://www.stijf.com/wordpress/2010/03/oracle-advanced-queues-aq/
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/35489/viewspace-1231891/ ,如需转载,请注明出处,否则将追究法律责任。