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.

* Get owner, queue where message is available */<br />

idx = ret_agt.getAddress().indexOf(".");<br />

if(idx != -1)<br />

{<br />

owner = ret_agt.getAddress().substring(0, idx);<br />

queue_name = ret_agt.getAddress().substring(idx + 1);<br />

/* Dequeue the message */<br />

deq_option = new AQDequeueOption();<br />

deq_option.setConsumerName(ret_agt.getName());<br />

deq_option.setWaitTime(1);<br />

orders_q = aq_sess.getQueue(owner, queue_name);<br />

/* Dequeue the message */<br />

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

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

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

}<br />

Dequeue Features<br />

System.out.println("Order number " + deq_order.getOrderno() + " retrieved");<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 />

Message Transformation During Dequeue<br />

Continuing the scenario introduced in "Message Format Transformation" on<br />

page 8-6 and "Message Transformation During Enqueue" on page 8-54, the queues<br />

in the OE schema are of payload type OE.orders_typ and the queues in the WS<br />

schema are of payload type WS.orders_typ_sh.<br />

A Sample Application Using AQ 8-95

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

Saved successfully!

Ooh no, something went wrong!