This series of posts isintended to provide the reader with an understanding of the basic features and capabilities of Oracle Advanced Queuing (AQ) for consideration in application development. It does not cover all of the features and capabilities of Oracle AQ. The reader is cautioned that the author is neither omniscient nor infallible. The reader should consult the Oracle documentation (Oracle® Streams Advanced Queuing User’s Guide and Oracle® Database PL/SQL Packages and Types Reference) prior to beginning application development.
Oracle AQ provides PL/SQL, OCI, JMS and SOAP APIs. While the all offer virtually identical functionality, this series refers only to the PL/SQL packages, DBMS_AQ and DBMS_AQADM.
What is Messaging?
Messaging is the ability to send a message containing data from one application/process to another application/process. It is a widely used technique in distributed systems, particularly high volume OLTP systems. Unlike client server applications, which are typically synchronous, messaging is typically asynchronous, i.e. the sender, referred to as the producer, is not blocked waiting for a reply from the recipient(s), referred to as consumer(s ). Oracle Advance Queuing (AQ) does not support synchronous messaging.
Messaging has many uses and advantages. It allows applications and systems to communicate and co-operate in an API independent manner. An order entry system may send a message containing order information to a fulfillment system without requiring access to internal APIs. The same message may also simultaneously be routed to an inventory management system, a customer support application, an email acknowledgment application, etc.
Messages are placed into queues, called enqueuing. The enqueuing applications are called the producers. There is typically no restriction on the number of producers for a given queue.
The application data portion of the message is referred to as the payload.
Messages are read and removed from the queue by dequeuing the message. Applications dequeuing messages are referred to as consumers.
There are three general categories of messaging:
- Single consumer, a.k.a., point-to-point – a message is dequeued by a single consumer
- Multicast – the producer effectively names designated consumers for the message
- Broadcast – consumers may dynamically gain access to a message queue by subscribing
A robust messaging systems supports a wide variety of features in addition to those describe above. These include:
- Error handling
- Timeouts and expirations
- Enqueuing/dequeuing of messages as a group
- Dequeueing messages by criteria other than FIFO, including, but not limited to :
- Enqueue time
- Contents of messages
- Propagation – pushing messages to destinations
- Other queues
- Other databases
- Other messaging systems (JMS, middleware, gateways)
- Retention of messages and history of actions
- Performance evaluation
- Wide range of message content data types (aka payload), including :
- BLOB, LOB, CLOB
- Structured records
- Notification to consumers of message availability
- Guaranteed delivery
- High performance
Oracle AQ provides all of this functionality.
In addition, Oracle AQ also provides the ability to browse messages without dequeuing.
In Part 2, we’ll take a closer look at queue types.