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.

JMS Message Producer Features<br />

Example Scenario and Code<br />

Using the BooksOnLine application, a customer can request one of the following:<br />

FedEx shipping (priority 3)<br />

Priority air shipping (priority 2)<br />

Regular ground shipping (priority 1)<br />

<br />

Priority can be specified at the Message Producer level using the setPriority<br />

call, or during the send or publish call. The latter overrides the former.<br />

The Order Entry application uses a FIFO queue to store new orders. New orders are<br />

processed by the order entry application and published to the booked orders topic.<br />

The order entry application will retrieve messages from the new orders queue in the<br />

order of their enqueue time. It uses a FIFO-priority topic to store booked orders.<br />

Booked orders are propagated to the regional booked orders topics. At each region,<br />

orders in these regional booked orders topics are processed in the order of the<br />

shipping priorities. The following calls create the FIFO-priority topic for the Order<br />

Entry application to store booked orders.<br />

public static void createPriorityTopic(TopicSession jms_session)<br />

{<br />

AQQueueTableProperty qt_prop;<br />

AQQueueTable pr_qtable;<br />

AQjmsDestinationProperty dest_prop;<br />

Topic bookedorders_topic;<br />

try<br />

{<br />

/* Create a priority queue table for OE */<br />

qt_prop = new AQQueueTableProperty("SYS.AQ$_JMS_OBJECT_MESSAGE");<br />

qt_prop.setComment("Order Entry Priority " +<br />

"MultiConsumer Orders queue table");<br />

qt_prop.setCompatible("8.1");<br />

qt_prop.setMultiConsumer(true);<br />

/* Set a FIFO-priority order */<br />

qt_prop.setSortOrder("priority, enq_time");<br />

pr_qtable = ((AQjmsSession)jms_session).createQueueTable("OE",<br />

"OE_orders_pr_mqtab", qt_prop);<br />

/* Create a Queue in this queue table */<br />

dest_prop = new AQjmsDestinationProperty();<br />

Creating Applications Using JMS 12-57

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

Saved successfully!

Ooh no, something went wrong!