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

Publish-Subscribe Support<br />

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

SELECT SUM(SO.enq_time - BO.enq_time) / count (*) AVG_PRCS_TIME<br />

FROM WS.AQ$WS_orders_pr_mqtab BO , WS.AQ$WS_orders_mqtab SO<br />

WHERE SO.msg_state = 'PROCESSED' and BO.msg_state = 'PROCESSED'<br />

AND SO.corr_id = BO.corr_id and SO.queue = 'WS_shippedorders_que';<br />

/* Average waiting time in the backed order queue: */<br />

SELECT SUM(BACK.deq_time - BACK.enq_time)/count (*) AVG_BACK_TIME<br />

FROM WS.AQ$WS_orders_mqtab BACK<br />

WHERE BACK.msg_state = 'PROCESSED' AND BACK.queue = 'WS_backorders_que';<br />

Visual Basic (OO4O): Example Code<br />

Use the dbexecutesql interface from the database for this functionality.<br />

Java (JDBC): Example Code<br />

No example is provided with this release.<br />

<strong>Advanced</strong> <strong>Queuing</strong> supports the publish-subscribe model of application<br />

integration. In the model, publishing applications put the message in the queue.<br />

The subscribing applications subscribe to the message in the queue. More<br />

publishing and subscribing applications can be dynamically added without<br />

changing the existing publishing and subscribing applications. <strong>Advanced</strong> <strong>Queuing</strong><br />

also supports content-based subscriptions. The subscriber can subscribe to a subset<br />

of messages in the queue based on the message properties and the contents of the<br />

messages. A subscriber to a queue can also be another queue or a consumer on<br />

another queue.<br />

You can implement a publish-subscribe model of communication using <strong>Advanced</strong><br />

<strong>Queuing</strong> as follows:<br />

Set up one or more queues to hold messages. These queues should represent an<br />

<br />

area or subject of interest. For example, a queue can be used to represent billed<br />

orders.<br />

Set up a set of rule-based subscribers. Each subscriber may specify a rule which<br />

<br />

represents a specification for the messages that the subscriber wishes to receive.<br />

A null rule indicates that the subscriber wishes to receive all messages.<br />

Publisher applications publish messages to the queue by invoking an enqueue<br />

<br />

call.<br />

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