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 />

/* Create an AQ Session: */<br />

aq_sess = AQDriverManager.createAQSession(db_conn);<br />

deq_option = new AQDequeueOption();<br />

deq_option.setConsumerName(consumer);<br />

deq_option.setWaitTime(1);<br />

deq_option.setCorrelation("RUSH");<br />

if(consumer.equals("West_Shipping"))<br />

{<br />

bookedorders_q = aq_sess.getQueue("WS", "WS_bookedorders_que");<br />

}<br />

else if(consumer.equals("East_Shipping"))<br />

{<br />

bookedorders_q = aq_sess.getQueue("ES", "ES_bookedorders_que");<br />

}<br />

else<br />

{<br />

bookedorders_q = aq_sess.getQueue("OS", "OS_bookedorders_que");<br />

}<br />

while(new_orders)<br />

{<br />

try<br />

{<br />

/* Dequeue the message */<br />

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

}<br />

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

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

8-62 <strong>Oracle</strong>9i Application Developer’s Guide - <strong>Advanced</strong> <strong>Queuing</strong><br />

System.out.println("Order number " + deq_order.getOrderno() +<br />

" is a rush order");<br />

}<br />

catch (AQException aqex)<br />

{<br />

new_orders = false;<br />

System.out.println("No more rush titles");<br />

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

}

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

Saved successfully!

Ooh no, something went wrong!