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.

Enqueue Features<br />

cannot have the same values for the NAME, ADDRESS and PROTOCOL attributes for<br />

the AQ$_AGENT type. At least one of the three attributes must be different for two<br />

subscribers (see "Agent Type (aq$_agent)" on page 2-3 for formal description of this<br />

data structure).<br />

You cannot add subscriptions to single-consumer queues or exception queues. A<br />

consumer that is added as a subscriber to a queue will only be able to dequeue<br />

messages that are enqueued after the DBMS_AQADM.ADD_SUBSCRIBER procedure<br />

is completed. In other words, messages that had been enqueued before this<br />

procedure is executed will not be available for dequeue by this consumer.<br />

You can remove a subscription by using the DBMS_AQADM.REMOVE_SUBSCRIBER<br />

procedure (see "Removing a Subscriber" in Chapter 9, "Administrative Interface").<br />

AQ will automatically remove from the queue all data corresponding to the<br />

consumer identified by the AQ$_AGENT parameter. In other words, it is not an error<br />

to execute the REMOVE_SUBSCRIBER procedure even when there are pending<br />

messages that are available for dequeue by the consumer. These messages will be<br />

automatically made unavailable for dequeue after the REMOVE_SUBSCRIBER<br />

procedure is executed. In a queue table that is created with the compatible<br />

parameter set to '8.1' or higher, such messages that were not dequeued by the<br />

consumer will be shown as "UNDELIVERABLE" in the AQ$ view.<br />

Note that a multiconsumer queue table created without the compatible parameter,<br />

or with the compatible parameter set to '8.0', does not display the state of a message<br />

on a consumer basis, but only displays the global state of the message.<br />

Recipient Lists<br />

You do not need to specify subscriptions for a multiconsumer queue if the<br />

producers of messages for enqueue supply a recipient list of consumers. In some<br />

situations it may be desirable to enqueue a message that is targeted to a specific set<br />

of consumers rather than the default list of subscribers. You accomplish this by<br />

specifying a recipient list at the time of enqueuing the message.<br />

In PL/SQL you specify the recipient list by adding elements to the<br />

<br />

recipient_list field of the message_properties record.<br />

In OCI the recipient list is specified by using the LNOCISetAttr procedure to<br />

<br />

specify an array of LNOCI_DTYPE_AQAGENT descriptors as the recipient list<br />

(LNOCI_ATTR_RECIPIENT_LIST attribute) of an LNOCI_DTYPE_AQMSG_<br />

PROPERTIES message properties descriptor.<br />

If a recipient list is specified during enqueue, it overrides the subscription list. In<br />

other words, messages that have a specified recipient list will not be available for<br />

dequeue by the subscribers of the queue. The consumers specified in the recipient<br />

A Sample Application Using AQ 8-37

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

Saved successfully!

Ooh no, something went wrong!