Oracle Essentials [Electronic resources] : Oracle Database 10g, 3rd Edition نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Oracle Essentials [Electronic resources] : Oracle Database 10g, 3rd Edition - نسخه متنی

Jonathan Stern

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید










12.4 Advanced Queuing


In the
1980s, message-oriented
middleware (MOM) gained popular usage.
MOM uses messages to transmit information
between systems. It doesn't require the overhead of
a two-phase commit because the MOM itself guarantees the delivery of
all messages. Products such as
IBM's
MQSeries store control information (message destination, expiration,
priority, and recipients) and the message contents in a file-based
queue. Delivery is guaranteed in that the message will remain in the
queue until the destination is available and the message is
forwarded.

Oracle's Advanced Queuing (AQ) facility, first
introduced with Oracle8 Enterprise Edition, provides a complete
queuing environment by storing the queue in the Oracle relational
database. Advanced queues are Oracle database tables that support
queuing operationsin particular,
enqueue
to create messages and
dequeue
to consume them. These messages, which can either be unstructured
(raw) or structured (as Oracle objects, which are described in
Chapter 13), correspond to rows in a table. Messages are stored in
normal queues for normal message handling or in exception queues if
they cannot be retrieved for some reason.


12.4.1 Queue Creation and Management


Queues are created through PL/SQL statements or the Java API.
Oracle9i
introduced several new AQ capabilities:

XML-based messaging over HTTP enables
support across firewalls; requests may be through the XML-based
Internet Document Access Protocol
(iDAP).

AQ policies and services can be defined using Dynamic Services.

AQ agents can be defined in and managed through the Oracle Internet
Directory (OID).


An administrator creates a queue by following these steps:

Create a queue table.

Create and name the queue.

Specify the queue as a normal queue or an exception queue.

Specify how long messages remain in the queue: indefinitely, for a
fixed length of time, until a particular time elapses between
retries, or based on the number of retries.


Queues can be started and stopped by the administrator, who also
grants users the privileges necessary for using the queue and revokes
those privileges when necessary.

Producers of messages specify a queue name, enqueue options, message
properties, and the payload to be put into the queue, which is then
handled by a producer agent. Consumer agents listen for messages in
one or more queues that are then dequeued so users can use the
contents. Notification of the existence of messages in the queue can
occur via OCI callback registration or through a listen call that can
be used by applications to monitor for messages in multiple queues.

Because messages are stored in queues in the database, a number of
message-management features are available. End-to-end tracking is
enabled because each message carries its history with it, including
location and state of the message, nodes visited, and previous
recipients. Messages that don't reach subscribers
within a defined lifetime are moved to the exception queue, from
which they can be traced. Messages that successfully reach
subscribers may be retained after consumption for additional
analysis, including enqueue and dequeue times. As messages may be
related (for example, one message might be caused by the successful
execution of two other messages), retaining the messages can be
useful in tracking sequences.

Queue management through Oracle Enterprise Manager Java version
includes the following tasks:

Creating, dropping, starting, and stopping queues

Adding and removing subscribers

Scheduling message propagation from local to remote queues

Displaying queue statistics, including the average queue length, the
number of messages in the wait state, the number of messages in the
ready state, and the number of expired messages


Since Oracle9i, AQ has included a built-in
message transformation for PL/SQL and XSLT. A messaging gateway is
also available for propagation to other systems, such as MQSeries and
TIBCO.


12.4.2 Publish-and-Subscribe Capabilities


Oracle8i
Enterprise Edition introduced publish-and-subscribe capabilities to
Advanced Queuing. As illustrated in Figure 12-3, a
publisher
puts a message onto a queue, while a
subscriber
receives messages from a queue. The publisher and subscriber interact
separately with the queue, and neither party needs to know of the
existence of the other. Publishers decide when, how, and what to
publish, while subscribers express an interest. Messages can be
published and subscribed to based on the name of a subject or on its
content (through filtering rules). Asynchronous notification is
enabled when subscribers register callback functions.


Figure 12-3. Advanced Queuing configuration for publish-subscribe applications


You can use Advanced Queuing and its publish-and-subscribe features
for additional notification of database events that, in turn, improve
the management of the database or business applications. Database
events such as DML (inserts, updates, deletions) and system events
(startup, shutdown, and so on) can be published and subscribed to. As
an example, an application may be built to automatically inform a
subscriber when a shipment occurs to certain highly valued customers;
the subscriber would then know that she should begin to track the
shipment's progress and alert the customer that
it's in transit.


/ 167