Skip Headers

Oracle® Streams Advanced Queuing User's Guide and Reference
Release 10.1

Part Number B10785-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

3 Basic Components

This chapter describes the Oracle Streams Advanced Queuing (AQ) basic components.

This chapter contains the following topics:

Object Name (object_name)


Purpose

Names database objects. This naming convention applies to queues, queue tables, and object types.


Syntax
object_name := VARCHAR2
object_name := [schema_name.]name

Usage

Names for objects are specified by an optional schema name and a name. If the schema name is not specified, then the current schema is assumed. The name must follow the reserved character guidelines in Oracle Database SQL Reference. The schema name, agent name, and the object type name can each be up to 30 bytes long. However, queue names and queue table names can be a maximum of 24 bytes.

Type Name (type_name)


Purpose

Defines queue types.


Syntax
type_name := VARCHAR2
type_name := object_type | "RAW"

Usage

For details on creating object types refer to Oracle Database Concepts. The maximum number of attributes in the object type is limited to 900.

To store payload of type RAW, Oracle Streams AQ creates a queue table with a LOB column as the payload repository. The size of the payload is limited to 32K bytes of data. Because LOB columns are used for storing RAW payload, the Oracle Streams AQ administrator can choose the LOB tablespace and configure the LOB storage by constructing a LOB storage string in the storage_clause parameter during queue table creation time.


Note:

Payloads containing LOBs require users to grant explicit Select, Insert and Update privileges on the queue table for doing enqueues and dequeues.

AQ Agent Type (aq$_agent)


Purpose

Identifies a producer or a consumer of a message.


Syntax
TYPE aq$_agent IS OBJECT (
   name            VARCHAR2(30), 
   address         VARCHAR2(1024),
   protocol        NUMBER)

Usage

All consumers that are added as subscribers to a multiconsumer queue must have unique values for the AQ$_AGENT parameters. You can add more subscribers by repeatedly using the DBMS_AQADM.ADD_SUBSCRIBER procedure up to a maximum of 1024 subscribers for a multiconsumer queue. Two subscribers cannot have the same values for the NAME, ADDRESS, and PROTOCOL attributes for the AQ$_AGENT type. At least one of the three attributes must be different for two subscribers.


Parameters
name (VARCHAR2(30))

Name of a producer or consumer of a message. The name of the agent can be the name of an application or a name assigned by an application. A queue can itself be an agent, enqueuing or dequeuing from another queue. The name must follow the reserved character guidelines in Oracle Database SQL Reference.

address (VARCHAR2(1024))

A character field of up to 1024 bytes that is interpreted in the context of the protocol. If the protocol is 0 (default), then the address is of the form [schema.]queue[@dblink].

protocol (NUMBER)

Protocol to interpret the address and propagate the message. The default value is 0.

AQ Recipient List Type (aq$_recipient_list_t)


Purpose

Identifies the list of agents that receive the message.


Syntax
TYPE aq$_recipient_list_t IS TABLE OF aq$_agent
           INDEX BY BINARY_INTEGER; 

AQ Agent List Type (aq$_agent_list_t)


Purpose

Identifies the list of agents for DBMS_AQ.LISTEN to listen for.


Syntax
TYPE aq$_agent_list_t IS TABLE OF aq$_agent 
           INDEX BY BINARY INTEGER; 

AQ Subscriber List Type (aq$_subscriber_list_t)


Purpose

Identifies the list of subscribers that subscribe to this queue.


Syntax
TYPE aq$_subscriber_list_t IS TABLE OF aq$_agent
          INDEX BY BINARY INTEGER; 

AQ Registration Information List Type (aq$_reg_info_list)


Purpose

Identifies the list of registrations to a queue.


Syntax
TYPE aq$_reg_info_list AS VARRAY(1024) OF sys.aq$_reg_info

AQ Post Information List Type (aq$_post_info_list)


Purpose

Identifies the list of anonymous subscriptions to which messages are posted.


Syntax
TYPE aq$_post_info_list AS VARRAY(1024) OF sys.aq$_post_info

AQ Registration Information Type (aq$_reg_info)


Purpose

The aq$_reg_info data structure identifies a producer or a consumer of a message.


Syntax
TYPE sys.aq$_reg_info IS OBJECT (
   name      VARCHAR2(128),
   namespace NUMBER,
   callback  VARCHAR2(4000),
   context   RAW(2000));

Attributes
name

Specifies the name of the subscription. The subscription name is of the form schema.queue if the registration is for a single consumer queue and schema.queue:consumer_name if the registration is for a multiconsumer queue.

namespace

Specifies the namespace of the subscription. To receive notifications from Oracle Streams AQ queues, the namespace must be DBMS_AQ.NAMESPACE_AQ. To receive notifications from other applications using DBMS_AQ.POST or OCISubscriptionPost(), the namespace must be DBMS_AQ.NAMESPACE_ANONYMOUS.

callback

Specifies the action to be performed on message notification. For e-mail notifications, the form is mailto://xyz@company.com. For Oracle Streams AQ PL/SQL Callback, use plsql://schema.procedure?PR=0 for raw message payload or plsql://schema.procedure?PR=1 for Oracle object type message payload converted to XML.

context

Specifies the context that is to be passed to the callback function. The default is NULL.

Table 3-1 shows the actions performed for nonpersistent queues for different notification mechanisms when RAW presentation is specified. Table 3-2 shows the actions performed when XML presentation is specified.

Table 3-1 Actions Performed for Nonpersistent Queues When RAW Presentation Specified

Queue Payload Type OCI Callback E-mail PL/SQL Callback
RAW OCI callback receives the RAW data in the payload. Not supported PL/SQL callback receives the RAW data in the payload.
Oracle object type Not supported Not supported Not supported

Table 3-2 Actions Performed for Nonpersistent Queues When XML Presentation Specified

Queue Payload Type OCI Callback E-mail PL/SQL Callback
RAW OCI callback receives the XML data in the payload. XML data is formatted as a SOAP message and e-mailed to the registered e-mail address. PL/SQL callback receives the XML data in the payload.
Oracle object type OCI callback receives the XML data in the payload. XML data is formatted as a SOAP message and e-mailed to the registered e-mail address. PL/SQL callback receives the XML data in the payload.

AQ Notification Descriptor Type


Purpose

The aq$_descriptor data structure specifies the Oracle Streams AQ Descriptor received by the Oracle Streams AQ PL/SQL callbacks upon notification.


Syntax
TYPE sys.aq$_descriptor IS OBJECT (
  queue_name    VARCHAR2(30),
  consumer_name VARCHAR2(30),
  msg_id        RAW(16),
  msg_prop      msg_prop_t);

Attributes
queue_name

Name of the queue in which the message was enqueued which resulted in the notification.

consumer_name

Name of the consumer for the multiconsumer queue.

msg_id

ID of the message.

msg_prop

Message properties.

AQ Post Information Type


Purpose

The aq$_post_info data structure specifies anonymous subscriptions to which you want to post messages.


Syntax
TYPE sys.aq$_post_info IS OBJECT (
  name       VARCHAR2(128),
  namespace  NUMBER,
  payload    RAW(2000));

Attributes
name

Name of the anonymous subscription to which you want to post.

namespace

To receive notifications from other applications using DBMS_AQ.POST or OCISubscriptionPost(), the namespace must be DBMS_AQ.NAMESPACE_ANONYMOUS.

payload

The payload to be posted to the anonymous subscription. The default is NULL.

Enumerated Constants in the Oracle Streams AQ Administrative Interface

When enumerated constants such as INFINITE, TRANSACTIONAL, and NORMAL_QUEUE are selected as values, the symbol must be specified with the scope of the packages defining it. All types associated with the administrative interfaces must be prepended with DBMS_AQADM. For example:

DBMS_AQADM.NORMAL_QUEUE

Table 3-3 lists the enumerated constants.

Table 3-3 Enumerated Constants in the Oracle Streams AQ Administrative Interface

Parameter Options
retention 0,1,2...INFINITE
message_grouping TRANSACTIONAL, NONE
queue_type NORMAL_QUEUE, EXCEPTION_QUEUE,NON_PERSISTENT_QUEUE

Enumerated Constants in the Oracle Streams AQ Operational Interface

When using enumerated constants such as BROWSE, LOCKED, and REMOVE, the PL/SQL constants must be specified with the scope of the packages defining them. All types associated with the operational interfaces must be prepended with DBMS_AQ. For example:

DBMS_AQ.BROWSE

Table 3-4 lists the enumerated constants.

Table 3-4 Enumerated Constants in the Oracle Streams AQ Operational Interface

Parameter Options
visibility IMMEDIATE, ON_COMMIT
dequeue mode BROWSE, LOCKED, REMOVE, REMOVE_NODATA
navigation FIRST_MESSAGE, NEXT_MESSAGE, NEXT_TRANSACTION
state WAITING, READY, PROCESSED, EXPIRED
sequence_deviation BEFORE, TOP
wait FOREVER, NO_WAIT
delay NO_DELAY
expiration NEVER
namespace NAMESPACE_AQ, NAMESPACE_ANONYMOUS

INIT.ORA Parameter File Considerations

You can specify the AQ_TM_PROCESSES and JOB_QUEUE_PROCESSES parameters in the init.ora parameter file.

AQ_TM_PROCESSES Parameter No Longer Needed in init.ora

Prior to Oracle Database 10g, Oracle Streams AQ time manager processes were controlled by the init.ora parameter AQ_TM_PROCESSES, which had to be set to nonzero to perform time monitoring on queue messages and for processing messages with delay and expiration properties specified. These processes were named QMNO-9 and could be changed using statement:

ALTER SYSTEM SET AQ_TM_PROCESSES=X

Parameter X ranged from 0 to 10. When X was set to 1 or more, that number of QMN processes were then started. If the parameter was not specified, or was set to 0, then queue monitor processes were not started.

In Oracle Streams AQ release 10.1, this has been changed to a coordinator-slave architecture, where a coordinator is automatically spawned if Oracle Streams AQ or Streams is being used in the system. This process, named QMNC, dynamically spawns slaves depending on the system load. The slaves, named qXXX, do various background tasks for Oracle Streams AQ or Streams. Because the number of processes is determined automatically and tuned constantly, you no longer need set AQ_TM_PROCESSES.

Even though it is no longer necessary to set AQ_TM_PROCESSES when Oracle Streams AQ or Streams is used, if you do specify a value, then that value is taken into account. However, the number of qXXX processes can be different from what was specified by AQ_TM_PROCESSES.

QMNC only runs when you use queues and create new queues. It affects Streams Replication and Messaging users.

No separate API is needed to disable or enable the background processes. This is controlled by setting AQ_TM_PROCESSES to zero or nonzero. Oracle recommends, however, that you leave the AQ_TM_PROCESSES parameter unspecified and let the system autotune.

Table 3-5 lists AQ_TM_PROCESSES parameter information.

Table 3-5 AQ_TM_PROCESSES Parameters

Parameter Options
Parameter Name aq_tm_processes
Parameter Type integer
Parameter Class Dynamic
Allowable Values 0 to 10
Syntax aq_tm_processes = allowable_value
Name of process ora_qmnc_ORACLE_SID

ora_q00n_ORACLE_SID

Example aq_tm_processes = 1

JOB_QUEUE_PROCESSES Parameter

Propagation is handled by job queue (Jnnn) processes. The number of job queue processes started in an instance is controlled by the init.ora parameter JOB_QUEUE_PROCESSES. The default value of this parameter is 0. For message propagation to take place, this parameter must be set to at least 2. The database administrator can set it to higher values if there are many queues from which the messages must be propagated, or if there are many destinations to which the messages must be propagated, or if there are other jobs in the job queue.


See Also:

Oracle Database SQL Reference for more information on JOB_QUEUE_PROCESSES