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.

end;<br />

Nonpersistent Queues<br />

END LOOP;<br />

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

A message in a nonpersistent queue is not stored in a database table. You create a<br />

nonpersistent queue, which can be either a single-consumer or multiconsumer type.<br />

These queues are created in a system-created queue table (AQ$_MEM_SC for<br />

single-consumer queues and AQ$_MEM_MC for multiconsumer queues) in the<br />

schema specified by the create_np_queue command. Subscribers can be added<br />

to the multiconsumer queues (see "Creating a Nonpersistent Queue" on page 9-26).<br />

Nonpersistent queues can be destinations for propagation.<br />

You use the enqueue interface to enqueue messages into a nonpersistent queue in<br />

the normal way. You can enqueue RAW and Object Type (ADT) messages into a<br />

nonpersistent queue. You retrieve messages from a nonpersistent queue through the<br />

asynchronous notification mechanism, registering for the notification (using<br />

LNOCISubcriptionRegister or DBMS_AQADM.REGISTER) for the queues you<br />

are interested in (see "Registering for Notification" on page 11-55).<br />

When a message is enqueued into a queue, it is delivered to clients with active<br />

registrations for the queue. The messages are published to the interested clients<br />

without incurring the overhead of storing them in the database.<br />

See Also: Documentation on DBMS_AQADM.REGISTER in<br />

<strong>Oracle</strong>9i Supplied PL/SQL Packages and Types Reference and<br />

documentation on LNOCISubscriptionRegister in <strong>Oracle</strong> Call<br />

Interface Programmer’s Guide.<br />

Scenario<br />

Assume that there are three application processes servicing user requests at the<br />

Order Entry system. The connection dispatcher shares out connection requests from<br />

the application processes. It attempts to maintain a count of the number of users<br />

logged on to the Order Entry system and the number of users for each application<br />

process. The application processes are named APP_1, APP_2, APP_3. (Application<br />

process failures are not considered in this example.)<br />

Using nonpersistent queues meets the requirements in this scenario. When a user<br />

logs on to the database, the application process enqueues to the multiconsumer<br />

nonpersistent queue, LOGIN_LOGOUT, with the application name as the consumer<br />

name. The same process occurs when a user logs out. To distinguish between the<br />

A Sample Application Using AQ 8-17

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

Saved successfully!

Ooh no, something went wrong!