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.

Dequeuing a Message from a Single-Consumer Queue [SpecifyOptions]<br />

}<br />

db_conn = ((AQ<strong>Oracle</strong>Session)aq_sess).getDBConnection();<br />

queue = aq_sess.getQueue ("aq", "msg_queue");<br />

/* Create a AQDequeueOption object with default options: */<br />

deq_option = new AQDequeueOption();<br />

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

/* Dequeue a message */<br />

message = queue.dequeue(deq_option);<br />

System.out.println("Successful dequeue");<br />

/* Retrieve raw data from the message: */<br />

raw_payload = message.getRawPayload();<br />

b_array = raw_payload.getBytes();<br />

db_conn.commit();<br />

Visual Basic (OO4O): Dequeue a message<br />

Dequeuing messages of RAW type<br />

'Dequeue the first message available<br />

Q.Dequeue()<br />

Set Msg = Q.QMsg<br />

'Display the message content<br />

MsgBox Msg.Value<br />

'Dequeue the first message available without removing it<br />

' from the queue<br />

Q.DequeueMode = ORAAQ_DEQ_BROWSE<br />

'Dequeue the first message with the correlation identifier<br />

' equal to "RELATIVE_MSG_ID"<br />

Q.Navigation = ORAAQ_DQ_FIRST_MSG<br />

Q.correlate = "RELATIVE_MESSAGE_ID"<br />

Q.Dequeue<br />

'Dequeue the next message with the correlation identifier<br />

11-50 <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!