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 JMS<br />

Example Scenario and Code<br />

The BooksOnLine application processes customer billings in its CB and CBADM<br />

schemas. CB (Customer Billing) schema hosts the customer billing application, and<br />

the CBADM schema hosts all related billing data stored as queue tables. To protect<br />

the billing data, the billing application and the billing data reside in different<br />

schemas. The billing application is allowed only to dequeue messages from CBADM_<br />

shippedorders_topic, the shipped order topic. It processes the messages, and<br />

then enqueues new messages into CBADM_billedorders_topic, the billed order<br />

topic.<br />

To protect the queues from other illegal operations from the application, the<br />

following two grant calls are made:<br />

/* Grant dequeue privilege on the shipped orders queue to the Customer<br />

Billing application. The CB application retrieves orders that are shipped<br />

but not billed from the shipped orders queue. */<br />

((AQjmsDestination)cbadm_shippedorders_topic).grantTopicPrivilege(t_sess,<br />

"DEQUEUE", "CB", false);<br />

where t_sess is the session<br />

/* Grant enqueue privilege on the billed orders queue to Customer Billing<br />

application.The CB application is allowed to put billed orders into this<br />

queue after processing the orders. */<br />

((AQjmsDestination)cbadm_billedorders_topic).grantTopicPrivilege(t_sess,<br />

"ENQUEUE", "CB", false);<br />

Retention and Message History in JMS<br />

AQ allows users retain messages in the queue table. This means that SQL can then<br />

be used to query these message for analysis. Messages are often related to each<br />

other. For example, if a message is produced as a result of the consumption of<br />

another message, the two are related. As the application designer, you may want to<br />

keep track of such relationships. Along with retention and message identifiers, AQ<br />

lets you automatically create message journals, also called tracking journals or event<br />

journals. Taken together -- retention, message identifiers and SQL queries -- make it<br />

possible to build powerful message warehouses.<br />

Example Scenario and Code<br />

Let us suppose that the shipping application needs to determine the average<br />

processing times of orders. This includes the time the order has to wait in the<br />

12-18 <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!