编辑:这似乎与将两个队列放在同一个模式中有关。
我正在尝试尝试队列传播,但在目标队列中没有看到记录。但这很可能是因为我没有准备好所有的部分。
有人有可以发布的测试用例吗?我将在下面包含我尝试过的内容。我发现文档中的故障排除有点轻,传播是如此的黑匣子,很难知道为什么它没有移动。
这就是我所拥有的;没有笑。
CREATE OR REPLACE TYPE test_payload AS OBJECT(
test_id NUMBER,
test_dt DATE);
DECLARE
subscriber SYS.aq$_agent;
BEGIN
--- Create Originating Queue and start it
DBMS_AQADM.create_queue_table( queue_table => 'Test_MQT', queue_payload_type => 'Test_Payload',
multiple_consumers => TRUE ); --- multiple subscriber
DBMS_AQADM.create_queue( 'Test_Q', 'Test_MQT' );
DBMS_AQADM.start_queue( queue_name => 'Test_Q' );
--- Create Destination Queue and start it
DBMS_AQADM.create_queue_table( queue_table => 'Dest_MQT', queue_payload_type => 'Test_Payload',
multiple_consumers => TRUE );
DBMS_AQADM.create_queue( 'Dest_Q', 'Dest_MQT' );
DBMS_AQADM.start_queue( queue_name => 'Dest_Q' );
--- Add Subscriber and schedule propagation
subscriber := SYS.aq$_agent( 'test_local_sub', 'Dest_Q', NULL );
DBMS_AQADM.add_subscriber( queue_name => 'Test_Q', subscriber => subscriber );
DBMS_AQADM.schedule_propagation( queue_name => 'Test_Q', destination_queue => 'Dest_Q' );
END;
DECLARE
enqueue_options DBMS_AQ.enqueue_options_t;
message_properties DBMS_AQ.message_properties_t;
message_handle RAW( 16 );
MESSAGE test_payload;
BEGIN
MESSAGE := test_payload( 2, SYSDATE );
DBMS_AQ.enqueue( queue_name => 'Test_Q', enqueue_options => enqueue_options,
message_properties => message_properties, payload => MESSAGE, msgid => message_handle );
COMMIT;
END;
DECLARE
dequeue_options DBMS_AQ.dequeue_options_t;
message_properties DBMS_AQ.message_properties_t;
message_handle RAW( 16 );
MESSAGE test_payload;
BEGIN
dequeue_options.navigation := DBMS_AQ.first_message;
DBMS_AQ.dequeue( queue_name => 'Dest_Q', dequeue_options => dequeue_options,
message_properties => message_properties, payload => MESSAGE, msgid => message_handle );
DBMS_OUTPUT.put_line( 'Test_ID: ' || MESSAGE.test_id );
DBMS_OUTPUT.put_line( 'Test_Date: ' || MESSAGE.test_dt );
COMMIT;
END;