09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Propagation<br />

Propagation<br />

}<br />

System.out.println("Exception-2: " + ex);<br />

ex.printStackTrace();<br />

}<br />

Caution: You may need to create queues or queue tables, or start<br />

or enable queues, for certain examples to work:<br />

Enqueue of Messages for remote subscribers/recipients to a Multiconsumer Queue<br />

and Propagation Scheduling Using PL/SQL<br />

/* Create subscriber list: */<br />

DECLARE<br />

subscriber aq$_agent;<br />

/* Add subscribers RED and GREEN with different addresses to the suscriber<br />

list: */<br />

BEGIN<br />

BEGIN<br />

/* Add subscriber RED that will dequeue messages from another_msg_queue<br />

queue in the same datatbase */<br />

subscriber := aq$_agent(’RED’, ’another_msg_queue’, NULL);<br />

DBMS_AQADM.ADD_SUBSCRIBER(queue_name => ’msg_queue_multiple’,<br />

subscriber => subscriber);<br />

/* Schedule propagation from msg_queue_multiple to other queues in the<br />

same<br />

database: */<br />

DBMS_AQADM.SCHEDULE_PROPAGATION(queue_name => ’msg_queue_multiple’);<br />

/* Add subscriber GREEN that will dequeue messages from the msg_queue<br />

queue<br />

in another database reached by the database link another_db.world */<br />

subscriber := aq$_agent(’GREEN’, ’msg_queue@another_db.world’, NULL);<br />

DBMS_AQADM.ADD_SUBSCRIBER(queue_name => ’msg_queue_multiple’,<br />

subscriber => subscriber);<br />

/* Schedule propagation from msg_queue_multiple to other queues in the<br />

database "another_database": */<br />

A-62 <strong>Oracle</strong>9i Application Developer’s Guide - <strong>Advanced</strong> <strong>Queuing</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!