Oracle® Streams Advanced Queuing User's Guide and Reference Release 10.1 Part Number B10785-01 |
|
|
View PDF |
This chapter describes the Oracle Streams Advanced Queuing (AQ) basic components.
This chapter contains the following topics:
Enumerated Constants in the Oracle Streams AQ Administrative Interface
Enumerated Constants in the Oracle Streams AQ Operational Interface
Names database objects. This naming convention applies to queues, queue tables, and object types.
object_name := VARCHAR2 object_name := [schema_name.]name
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.
Defines queue types.
type_name := VARCHAR2 type_name := object_type | "RAW"
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 explicitSelect , Insert and Update privileges on the queue table for doing enqueues and dequeues. |
Identifies a producer or a consumer of a message.
TYPE aq$_agent IS OBJECT ( name VARCHAR2(30), address VARCHAR2(1024), protocol NUMBER)
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.
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.
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 to interpret the address and propagate the message. The default value is 0.
Identifies the list of agents that receive the message.
TYPE aq$_recipient_list_t IS TABLE OF aq$_agent INDEX BY BINARY_INTEGER;
Identifies the list of agents for DBMS_AQ.LISTEN
to listen for.
TYPE aq$_agent_list_t IS TABLE OF aq$_agent INDEX BY BINARY INTEGER;
Identifies the list of subscribers that subscribe to this queue.
TYPE aq$_subscriber_list_t IS TABLE OF aq$_agent INDEX BY BINARY INTEGER;
Identifies the list of registrations to a queue.
TYPE aq$_reg_info_list AS VARRAY(1024) OF sys.aq$_reg_info
Identifies the list of anonymous subscriptions to which messages are posted.
TYPE aq$_post_info_list AS VARRAY(1024) OF sys.aq$_post_info
The aq$_reg_info
data structure identifies a producer or a consumer of a message.
TYPE sys.aq$_reg_info IS OBJECT ( name VARCHAR2(128), namespace NUMBER, callback VARCHAR2(4000), context RAW(2000));
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.
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
.
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.
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 | 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 | 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. |
The aq$_descriptor
data structure specifies the Oracle Streams AQ Descriptor received by the Oracle Streams AQ PL/SQL callbacks upon notification.
TYPE sys.aq$_descriptor IS OBJECT ( queue_name VARCHAR2(30), consumer_name VARCHAR2(30), msg_id RAW(16), msg_prop msg_prop_t);
Name of the queue in which the message was enqueued which resulted in the notification.
Name of the consumer for the multiconsumer queue.
ID of the message.
Message properties.
The aq$_post_info
data structure specifies anonymous subscriptions to which you want to post messages.
TYPE sys.aq$_post_info IS OBJECT ( name VARCHAR2(128), namespace NUMBER, payload RAW(2000));
Name of the anonymous subscription to which you want to post.
To receive notifications from other applications using DBMS_AQ.POST
or OCISubscriptionPost()
, the namespace must be DBMS_AQ.NAMESPACE_ANONYMOUS
.
The payload to be posted to the anonymous subscription. The default is NULL
.
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.
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
You can specify the AQ_TM_PROCESSES
and JOB_QUEUE_PROCESSES
parameters in the init.ora
parameter file.
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.
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.