我正在尝试使用队列传播,但我没有在目标队列中看到记录。但这很容易因为我没有完成所有的工作。
有没有人有可以发布的测试用例?我将包括我在下面尝试的内容。我发现文档中的故障排除有点轻,传播是一个黑盒子,很难知道为什么这不会移动。
这就是我所拥有的;不要笑。
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;
答案 0 :(得分:1)
也许您需要启用它?
DBMS_AQADM.ENABLE_PROPAGATION_SCHEDULE(queue_name => 'Test_Q');
答案 1 :(得分:0)
你可能想通过AQ上的这个Tom Kyte线程阅读:
答案 2 :(得分:0)
您需要拥有传播目标队列的默认订阅者。需要有东西听取