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.

Dequeue Features<br />

BEGIN<br />

subscriber := aq$_agent('East_Shipping', 'ES.ES_bookedorders_que', null);<br />

dbms_aqadm.add_subscriber(<br />

queue_name => 'OE.OE_bookedorders_que',<br />

subscriber => subscriber,<br />

rule => 'tab.user_data.orderregion = ''EASTERN'' OR<br />

(tab.user_data.ordertype = ''RUSH'' AND<br />

tab.user_data.customer.country = ''USA'') ');<br />

END;<br />

Overseas Shipping defines an agent called Overseas_Shipping with the OS<br />

booked orders queue as the agent address (destination queue to which messages<br />

must be delivered). This agent subscribes to the OE booked orders queue using a<br />

rule specified on the orderregion attribute. Since the representation of orders at<br />

the Overseas Shipping site is different from the representation of orders at the Order<br />

Entry site, a transformation is applied before messages are propagated from the<br />

Order Entry site to the Overseas Shipping site.<br />

/* Add a rule-based subscriber (for Overseas Shipping) to the Booked orders<br />

queues with Transformation. Overseas Shipping handles all non-US orders: */<br />

DECLARE<br />

subscriber aq$_agent;<br />

BEGIN<br />

subscriber := aq$_agent('Overseas_Shipping','OS.OS_bookedorders_que',null);<br />

dbms_aqadm.add_subscriber(<br />

queue_name => 'OE.OE_bookedorders_que',<br />

subscriber => subscriber,<br />

rule => 'tab.user_data.orderregion = ''INTERNATIONAL''',<br />

transformation => 'OS.OE2XML');<br />

END;<br />

See "Message Format Transformation" on page 8-6 for more details on defining<br />

transformations.<br />

Assume that the Overseas Shipping site has a subscriber, Overseas_DHL, for<br />

handling RUSH orders. Since OS_bookedorders_que has the order details<br />

represented as an XMLType, the rule uses XPath syntax.<br />

DECLARE<br />

subscriber aq$_agent;<br />

BEGIN<br />

subscriber := aq$_agent('Overseas_DHL', null, null);<br />

dbms_aqadm.add_subscriber(<br />

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