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.

}<br />

Message Grouping<br />

}<br />

catch (Exception ex)<br />

{<br />

System.out.println("Exception :" + ex);<br />

}<br />

Enqueue Features<br />

Messages belonging to one queue can be grouped to form a set that can only be<br />

consumed by one user at a time. This requires that the queue be created in a queue<br />

table that is enabled for transactional message grouping (see "Creating a Queue<br />

Table" on page 9-4 in Chapter 9, "Administrative Interface"). All messages belonging<br />

to a group have to be created in the same transaction and all messages created in<br />

one transaction belong to the same group. With this feature, you can segment<br />

complex messages into simple messages.<br />

For example, messages directed to a queue containing invoices can be constructed<br />

as a group of messages starting with the header message, followed by messages<br />

representing details, followed by the trailer message. Message grouping is also<br />

useful if the message payload contains complex large objects such as images and<br />

video that can be segmented into smaller objects.<br />

The general message properties (priority, delay, expiration) for the messages in a<br />

group are determined solely by the message properties specified for the first<br />

message (head) of the group, irrespective of which properties are specified for<br />

subsequent messages in the group.<br />

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

important to note that the destination queue where messages have to be propagated<br />

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

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

dequeuing messages from a queue enabled for transactional grouping (see<br />

"Dequeue Methods" on page 8-58 and "Modes of Dequeuing" on page 8-69 for<br />

additional information).<br />

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 following example, each enqueue corresponds to an individual book that is<br />

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

A Sample Application Using AQ 8-51

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

Saved successfully!

Ooh no, something went wrong!