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.

JMS Message Producer Features<br />

The message grouping property is preserved across propagation. However, it is<br />

important to note that the destination topic to which messages have to be<br />

propagated must also be enabled for transactional grouping. There are also some<br />

restrictions you need to keep in mind if the message grouping property is to be<br />

preserved while dequeuing messages from a queue enabled for transactional<br />

grouping (see “Dequeue Methods" and "Modes of Dequeuing" for additional<br />

information).<br />

Example Scenario<br />

In the BooksOnLine application, message grouping can be used to handle new<br />

orders. Each order contains a number of books ordered one by one in succession.<br />

Items ordered over the Web exhibit similar behavior.<br />

In the example that follows, each send corresponds to an individual book that is<br />

part of an order, and the group/transaction represents a complete order. Only the<br />

first message contains customer information. Note that the OE_neworders_que is<br />

defined in the queue table OE_orders_sqtab which has been enabled for<br />

transactional grouping.<br />

Example Code<br />

public static void createMsgGroupQueueTable(QueueSession jms_session)<br />

{<br />

AQQueueTableProperty sqt_prop;<br />

AQQueueTable sq_table;<br />

AQjmsDestinationProperty dest_prop;<br />

Queue neworders_q;<br />

try<br />

{<br />

/* Create a single-consumer orders queue table<br />

* with message grouping = TRANSACTIONAL<br />

*/<br />

sqt_prop = new AQQueueTableProperty("BOLADM.order_typ");<br />

sqt_prop.setComment("Order Entry Single-Consumer Orders queue table");<br />

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

sqt_prop.setMessageGrouping(AQQueueTableProperty.TRANSACTIONAL);<br />

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

"OE_orders_sqtab", sqt_prop);<br />

/* Create new orders queue for OE */<br />

dest_prop = new AQjmsDestinationProperty();<br />

neworders_q = ((AQjmsSession)jms_session).createQueue(sq_table,<br />

Creating Applications Using JMS 12-63

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

Saved successfully!

Ooh no, something went wrong!