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.

Dequeue Features<br />

DBMS_AQADM.START_QUEUE procedure. You will get an <strong>Oracle</strong> error if you try to<br />

enable an exception queue for enqueue.<br />

When a message has expired, it is moved to an exception queue. The exception<br />

queue for a message in multiconsumer queue must also be a multiconsumer queue.<br />

Expired messages from multiconsumer queues cannot be dequeued by the intended<br />

recipients of the message. However, they can be dequeued in the REMOVE mode<br />

exactly once by specifying a NULL consumer name in the dequeue options. Hence,<br />

from a dequeue perspective multiconsumer exception queues behave like<br />

single-consumer queues because each expired message can be dequeued only once<br />

using a NULL consumer name. Messages can also be dequeued from the exception<br />

queue by specifying the message ID.<br />

The exception queue is a message property that can be specified during enqueue<br />

time (see "Enqueuing a Message [Specify Message Properties]" on page 11-9 in<br />

Chapter 11, "Operational Interface: Basic Operations"). In PL/SQL users can use the<br />

exception_queue attribute of the DBMS_AQ.MESSAGE_PROPERTIES_T record to<br />

specify the exception queue. In OCI users can use the LNOCISetAttr procedure to<br />

set the LNOCI_ATTR_EXCEPTION_QUEUE attribute of the<br />

LNOCIAQMsgProperties descriptor.<br />

If an exception queue is not specified, the default exception queue is used. If the<br />

queue is created in a queue table, for example, QTAB, the default exception queue<br />

will be called AQ$_QTAB_E. The default exception queue is automatically created<br />

when the queue table is created. Messages are moved to the exception queues by<br />

AQ under the following conditions:<br />

The message is not being dequeued within the specified expiration interval. For<br />

<br />

messages intended for more than one recipient, the message will be moved to<br />

the exception queue if one or more of the intended recipients was not able to<br />

dequeue the message within the specified expiration interval. The default<br />

expiration interval is DBMS_AQ.NEVER, meaning the messages will not expire.<br />

The message is being dequeued successfully. However, because of an error that<br />

arises while processing the message, the application that dequeues the message<br />

chooses to roll back the transaction. In this case, the message is returned to the<br />

queue and will be available for any applications that are waiting to dequeue<br />

from the same queue. A dequeue is considered rolled back or undone if the<br />

application rolls back the entire transaction, or if it rolls back to a save point that<br />

was taken before the dequeue. If the message has been dequeued but rolled<br />

back more than the number of times specified by the retry limit, the message<br />

will be moved to the exception queue.<br />

A Sample Application Using AQ 8-81

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

Saved successfully!

Ooh no, something went wrong!