Advanced Queuing   «Prev  Next»

Lesson 2What is Advanced Queuing?
ObjectiveExplain Oracle Advanced Queuing, its transaction boundaries, and when to consider AQ or TxEventQ in Oracle 26ai

Oracle Advanced Queuing (AQ): Messages, Transactions and Consumers

The acronym AQ in Oracle stands for Advanced Queuing. Oracle Advanced Queues provide a database-integrated messaging system that allows applications to exchange information asynchronously using database tables as the transport layer. Because AQ is built into the Oracle Database engine, it inherits core database capabilities such as transactional consistency, security, backup and recovery, and high availability.

In this lesson, you will learn what Advanced Queues are, how Oracle stores messages in queue tables, and why AQ remains a relevant option in Oracle 26ai and cloud-enabled deployments. Later lessons in this module will show how to enqueue and dequeue messages, build PL/SQL applications, and configure queue propagation. This page focuses on the concepts and architecture.

Learning objectives


Oracle Database 23c

Why use messaging inside the database?

Many applications need to perform work asynchronously. For example, an order-entry system may take a customer’s order immediately, then process payment, inventory checks, and shipment in the background. Rather than forcing all systems to be online and synchronized at once, a messaging system decouples producers and consumers of work.

Oracle Advanced Queues implement this messaging layer inside the database. Instead of running a separate message broker, AQ uses Oracle tables to store messages and Oracle background processes to manage delivery. This has several benefits:

Core AQ building blocks: messages, queues, and queue tables

At the logical level, Advanced Queuing revolves around three core concepts:

The figure summarizes the producer-to-queue-to-consumer flow:

Oracle Advanced Queuing flow from Producer to Queue (AQ) to Consumer
Figure 1. A producer enqueues a message; a consumer dequeues it. Queue-table storage and transaction boundaries are explained in the accompanying text.

Queue tables: how messages are stored

A queue table is a specially created Oracle table that holds messages for one or more queues. You do not manually design its columns; instead, you specify message characteristics and storage options, and Oracle builds the underlying structure for you. The queue table:

Use DBMS_AQADM for administration and supported messaging interfaces such as DBMS_AQ for enqueue/dequeue. Do not manually update message rows or add arbitrary indexes and partitions to Oracle-managed queue structures. Queue storage is an implementation detail with documented administration rules.

Example: commit an order and its message together

Suppose an application inserts order 801 and must request warehouse processing. With persistent enqueue visibility set to ON_COMMIT, it can insert the order and enqueue the work item in the same transaction. A commit makes both durable; a rollback abandons both. This avoids committing the order and then losing the request before an unrelated messaging call succeeds.

  1. The producer inserts order 801 and enqueues an OrderCreated message carrying its identifier.
  2. The producer commits. A consumer can now process the message.
  3. The consumer dequeues in a transaction, updates database fulfillment state, and commits.
  4. If that consumer transaction rolls back, its database changes are undone and the message can become available for another attempt under the queue's retry policy.

This is a transaction walkthrough, not a complete installation script. Immediate visibility and buffered messaging have different semantics. Choose the options deliberately rather than assuming every enqueue shares the caller's transaction.

External effects need separate protection. Sending an email or calling a payment API does not automatically roll back with the database. Use a stable event identifier and an idempotent consumer or external API so retrying work does not charge a customer twice. Database messaging guarantees do not eliminate this application responsibility.

Queues and consumers

A queue is defined on top of a queue table. Each queue has its own:

Consumers can be PL/SQL blocks, background jobs, middle-tier services, or external applications using database connectivity. Consumers in Oracle 26ai deployments might be:

Classic AQ and Transactional Event Queues

Oracle 26ai provides classic AQ and Transactional Event Queues (TxEventQ), an optimized implementation previously called sharded queues. Both integrate messaging with the database, but the selection should follow workload and API requirements.

For an existing AQ application, begin with its payload type, subscriber model, queue administration, and operational procedures. For a new high-throughput event workload, evaluate TxEventQ's supported interfaces and ordering model. Do not treat a change of queue technology as merely renaming an object.

A single-consumer queue can distribute work among competing workers. A multiconsumer queue tracks delivery for its intended recipients. Neither arrangement means that arbitrary parallel consumers finish messages in one global order. If updates for one customer must be applied sequentially, make that ordering requirement part of the design and test it under concurrency.

When to use Advanced Queues

Advanced Queues are particularly useful when you need:

If your architecture already depends heavily on the Oracle Database, AQ can be simpler and more maintainable than running a separate message broker—especially for small to medium integration workloads that benefit from transactional guarantees and centralized administration.

Performance and reliability considerations

Because AQ runs inside the database, performance and reliability are closely tied to standard Oracle tuning practices:

Later lessons in this module will show how enqueue and dequeue options affect concurrency, how to configure retention and message expiration, and how to tune queue tables for performance.

How this page fits into the Advanced Queues module

This page is the conceptual foundation for the Advanced Queues lessons. Use it as your reference for what AQ is and how its core components fit together. The following pages build on this material:

Once you are comfortable with the ideas presented here—message, queue, queue table, and the overall AQ architecture—you will be ready to explore the implementation details in the remaining lessons of this module.

Reference: Oracle introduction to TxEventQ and Advanced Queuing.


SEMrush Software 2 SEMrush Banner 2