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.

General Features of <strong>Advanced</strong> <strong>Queuing</strong><br />

Subscriber applications may receive messages in the following manner:<br />

A dequeue call retrieves messages that match the subscription criteria.<br />

A listen call may be used to monitor multiple queues for subscriptions on<br />

<br />

different queues. This is a more scalable solution in cases where a<br />

subscriber application has subscribed to many queues and wishes to receive<br />

messages that arrive in any of the queues.<br />

Use the OCI notification mechanism. This allows a push mode of message<br />

<br />

delivery. The subscriber application registers the queues (and subscriptions<br />

specified as subscribing agent) from which to receive messages. This<br />

registers a callback to be invoked when messages matching the<br />

subscriptions arrive.<br />

Scenario<br />

The BooksOnLine application illustrates the use of a publish-subscribe model for<br />

communicating between applications. The following subsections give some<br />

examples.<br />

Defining queues The Order Entry application defines a queue (OE_booked_<br />

orders_que) to communicate orders that are booked to various applications. The<br />

Order Entry application is not aware of the various subscriber applications and<br />

thus, a new subscriber application can be added without disrupting any setup or<br />

logic in the Order Entry (publisher) application.<br />

Setting Up Subscriptions The various shipping applications and the customer service<br />

application (that is, Eastern region shipping, Western region shipping, Overseas<br />

shipping and Customer Service) are defined as subscribers to the booked_orders<br />

queue of the Order Entry application. Rules are used to route messages of interest to<br />

the various subscribers. Thus, Eastern Region shipping, which handles shipment of<br />

all orders for the East coast and all rush U.S. orders, expresses the subscription rule<br />

as follows:<br />

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

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

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

Each subscriber can specify a local queue where messages are to be delivered. The<br />

Eastern region shipping application specifies a local queue (ES_booked_orders_<br />

que) for message delivery by specifying the subscriber address as follows:<br />

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

A Sample Application Using AQ 8-29

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

Saved successfully!

Ooh no, something went wrong!