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.

Creating a Queue Receiver for Queues of <strong>Oracle</strong> Object Type (ADT) Messages<br />

Usage Notes<br />

The CustomDatum factory for a particular java class that maps to the SQL ADT<br />

payload can be obtained using the getFactory static method.<br />

For queues containing AdtMessages the selector for QueueReceiver can be a SQL<br />

expression on the message payload contents or messageID or priority or<br />

correlationID.<br />

Selector on message id - to retrieve messages that have a specific messageID<br />

<br />

msgid = ’23434556566767676’<br />

Note: in this case message IDs must NOT be prefixed with ’ID:’<br />

Selector on priority or correlation is specified as follows<br />

<br />

priority < 3 AND corrid = ’Fiction’<br />

Selector on message payload is specified as follows<br />

<br />

tab.user_data.color = ’GREEN’ AND tab.user_data.price < 30000<br />

Syntax<br />

Java (JDBC): <strong>Oracle</strong>9i Supplied Java Packages Reference oracle.jms,<br />

AQjmsSession.createReceiver<br />

Example<br />

Assume the Queue - test_queue has payload of type SCOTT.EMPLOYEE and the<br />

java class that is generated by Jpublisher for this ADT is called Employee. The<br />

Employee class implements the CustomDatum interface. The CustomDatumFactory<br />

for this class can be obtained by using the Employee.getFactory() method.<br />

/* Create a receiver for a Queue with Adt messages of type EMPLOYEE*/<br />

QueueSession jms_session<br />

QueueReceiver receiver;<br />

Queue test_queue;<br />

browser = ((AQjmsSession)jms_session).createReceiver(test_queue,<br />

"JMSCorrelationID = ’MANAGER’, Employee.getFactory());<br />

14-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!