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.

Enqueuing and Dequeuing Of Messages<br />

}<br />

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

/* Creating a message to contain raw payload: */<br />

message = queue.createMessage();<br />

/* Get handle to the AQRawPayload object and populate it with raw data: */<br />

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

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

raw_payload.setStream(b_array, b_array.length);<br />

/* Creating a AQEnqueueOption object with default options: */<br />

enq_option = new AQEnqueueOption();<br />

/* Enqueue the message: */<br />

queue.enqueue(enq_option, message);<br />

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

db_conn.commit();<br />

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

deq_option = new AQDequeueOption();<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 />

Dequeue of Messages in Browse Mode Using Java<br />

{<br />

public static void runTest(AQSession aq_sess) throws AQException<br />

AQQueueTable q_table;<br />

AQQueueTable q_table;<br />

AQQueue queue;<br />

AQMessage message;<br />

A-28 <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!