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.

General Features of JMS<br />

/* Check instance affinity of OE queue tables from AQ administrative view: */<br />

SELECT queue_table, primary_instance, secondary_instance, owner_instance<br />

FROM user_queue_tables;<br />

/* Alter Instance Affinity of OE queue tables */<br />

q_table.alter("OE_orders_sqtab", 2, 1);<br />

q_table1.alter("OE_orders_mqtabl", 1, 2);<br />

Supporting Statistics Views in JMS<br />

Each instance keeps its own AQ statistics information in its own System Global<br />

Area (SGA), and does not have knowledge of the statistics gathered by other<br />

instances. Then, when a GV$AQ view is queried by an instance, all other instances<br />

funnel their AQ statistics information to the instance issuing the query.<br />

Example Scenario and Code<br />

The gv$view can be queried at any time to see the number of messages in waiting,<br />

ready or expired state. The view also displays the average number of seconds<br />

messages have been waiting to be processed. The order processing application can<br />

use this to dynamically tune the number of order-processing processes. See<br />

Chapter , "Selecting the Number of Messages in Different States for the Whole<br />

Database" in Chapter 10, "Administrative Interface: Views".<br />

CONNECT oe/oe<br />

/* Count the number as messages and the average time for which the messages<br />

have been waiting: */<br />

SELECT READY, AVERAGE_WAIT<br />

FROM gv$aq Stats, user_queues Qs<br />

WHERE Stats.qid = Qs.qid and Qs.Name = ’OE_neworders_que’;<br />

Structured Payload/Message Types in JMS<br />

JMS Messages are composed of the following parts:<br />

Header - All messages support the same set of header fields. Header fields<br />

<br />

contain values used by both clients and providers to identify and route<br />

messages<br />

Properties - In addition to the standard header fields, you can add optional<br />

<br />

header fields to a message<br />

Creating Applications Using JMS 12-21

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

Saved successfully!

Ooh no, something went wrong!