09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Enqueue Features<br />

first enqueue contains customer information. Note that the OE_neworders_que is<br />

stored in the table OE_orders_sqtab,which has been enabled for transactional<br />

grouping. Refer to the example code for descriptions of procedures new_order_<br />

enq() and same_order_enq().<br />

PL/SQL (DBMS_AQADM Package): Example Code<br />

connect OE/OE;<br />

Note: Queue names and queue table names are converted to<br />

upper case. Mixed case (upper and lower case together) is not<br />

supported for queue names and queue table names.<br />

/* Create queue table for OE: */<br />

EXECUTE dbms_aqadm.create_queue_table( \<br />

queue_table => ’OE_orders_sqtab’,\<br />

comment => ’Order Entry Single-Consumer Orders queue table’,\<br />

queue_payload_type => ’BOLADM.order_typ’,\<br />

message_grouping => DBMS_AQADM.TRANSACTIONAL, \<br />

compatible => ’8.1’, \<br />

primary_instance => 1,\<br />

secondary_instance => 2);<br />

/* Create neworders queue for OE: */<br />

EXECUTE dbms_aqadm.create_queue ( \<br />

queue_name => ’OE_neworders_que’,<br />

queue_table => ’OE_orders_sqtab’);<br />

/* Login into OE account :*/<br />

CONNECT OE/OE;<br />

SET serveroutput on;<br />

/* Enqueue some orders using message grouping into OE_neworders_que,<br />

First Order Group: */<br />

EXECUTE BOLADM.new_order_enq(’My First Book’, 1, 1001, ’CA’);<br />

EXECUTE BOLADM.same_order_enq(’My Second Book’, 2);<br />

COMMIT;<br />

/<br />

/* Second Order Group: */<br />

EXECUTE BOLADM.new_order_enq(’My Third Book’, 1, 1002, ’WA’);<br />

COMMIT;<br />

/<br />

/* Third Order Group: */<br />

EXECUTE BOLADM.new_order_enq(’My Fourth Book’, 1, 1003, ’NV’);<br />

EXECUTE BOLADM.same_order_enq(’My Fifth Book’, 3);<br />

8-52 <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!