09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Dequeue Features<br />

}<br />

Exception Handling<br />

/* Dequeue the message */<br />

message = bookedorders_q.dequeue(deq_option, Order.getFactory());<br />

obj_payload = message.getObjectPayload();<br />

deq_order = (Order)(obj_payload.getPayloadData());<br />

/* for simplicity, assume order has a single item */<br />

order_item = deq_order.getItems().getElement(0);<br />

book = order_item.getItem();<br />

/* assume search_inventory searches inventory for the book<br />

* if we don't find the book in the warehouse, abort transaction<br />

*/<br />

if(search_inventory(book) != true)<br />

db_conn.rollback();<br />

else<br />

process_order(deq_order);<br />

}<br />

catch (AQException aqex)<br />

{<br />

System.out.println("Exception-1: " + aqex);<br />

}<br />

catch (Exception ex)<br />

{<br />

System.out.println("Exception-2: " + ex);<br />

}<br />

AQ provides four integrated mechanisms to support exception handling in<br />

applications: EXCEPTION_QUEUES, EXPIRATION, MAX_RETRIES and RETRY_<br />

DELAY.<br />

An exception_queue is a repository for all expired or unserviceable messages.<br />

Applications cannot directly enqueue into exception queues. Also, a multiconsumer<br />

exception queue cannot have subscribers associated with it. However, an<br />

application that intends to handle these expired or unserviceable messages can<br />

dequeue from the exception queue. The exception queue created for messages<br />

intended for a multiconsumer queue must itself be a multiconsumer queue. Like<br />

any other queue, the exception queue must be enabled for dequeue using the<br />

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