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.

Retry with Delay Interval<br />

Dequeue Features<br />

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

OO4O supports asynchronous dequeuing of messages. First, the monitor is started<br />

for a particular queue. When messages that fulfil the user criteria are dequeued, the<br />

user's callback object is notified.<br />

Java (JDBC): Example Code<br />

AQDequeueOption deq-opt;<br />

deq-opt = new AQDequeueOption ();<br />

If the transaction dequeuing the message from a queue fails, it is regarded as an<br />

unsuccessful attempt to consume the message. AQ records the number of failed<br />

attempts to consume the message in the message history. Applications can query<br />

the retry_count column of the queue table view to find out the number of<br />

unsuccessful attempts on a message. In addition, AQ allows the application to<br />

specify, at the queue level, the maximum number of retries for messages in the<br />

queue. If the number of failed attempts to remove a message exceeds this number,<br />

the message is moved to the exception queue and is no longer available to<br />

applications.<br />

Retry Delay<br />

A bad condition can cause the transaction receiving a message to end. AQ allows<br />

users to hide the bad message for a prespecified interval. A retry_delay can be<br />

specified along with maximum retries. This means that a message that has had a<br />

failed attempt will be visible in the queue for dequeue after the retry_delay interval.<br />

Until then it will be in the WAITING state. In the AQ background process, the time<br />

manager enforces the retry delay property. The default value for maximum retries is<br />

5. The default value for retry delay is 0. Note that maximum retries and retry delay<br />

are not available with 8.0-compatible multiconsumer queues.<br />

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

/* Create a package that enqueue with delay set to one day: /*<br />

CONNECT BOLADM/BOLADM<br />

><br />

/* queue has max retries = 4 and retry delay = 12 hours */<br />

execute dbms_aqadm.alter_queue(queue_name = 'WS.WS_BOOKED_ORDERS_QUE',<br />

max_retr<br />

ies=4,<br />

retry_delay = 3600*12);<br />

A Sample Application Using AQ 8-77

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

Saved successfully!

Ooh no, something went wrong!