Basic Components of Advanced Queuing
Previous Chapter | Next Chapter
Basic Components of Advanced Queueing
The following basic components are discussed in this chapter:
* Data Structures
* Enumerated Constants in the Administrative Interface
* Enumerated Constants in the Operational Interface
* INIT.ORA Parameter File Considerations
Data Structures
Object Name (object_name)
Purpose
To name database objects. This naming convention applies to queues, queue tables, and object types.
Syntax
object_name := VARCHAR2
object_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 the Oracle9i 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
To define queue types.
Syntax
type_name := VARCHAR2
type_name := | "RAW"
Usage
Following Table lists usage information for type_name.
Following Table Type Name (type_name)
| Parameter |
Description |
| |
For details on creating object types please refer to Oracle9i Database Concepts. The maximum number of attributes in the object type is limited to 900. |
| "RAW" |
To store payload of type RAW, 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 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. |
Agent Type (aq$_agent)
Purpose
To identify 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.
Table lists usage information for aq$_agent.
Table Agent (aq$_agent)
| Parameter |
Description |
| name (VARCHAR2(30)) |
Name of a producer or consumer of a message.The name must follow the reserved character guidelines in the Oracle9i SQL Reference.
|
| address
(VARCHAR2(1024)) |
Protocol specific address of the recipient. If the protocol is 0 (default), 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
To identify the list of agents that will 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
To identify 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
To identify 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 Info List Type (aq$_reg_info_list)
Purpose
To identify the list of registrations to a queue.
Syntax
TYPE aq$_reg_info_list AS VARRAY(1024) OF sys.aq$_reg_info
AQ Post Info List Type (aq$_post_info_list)
Purpose
To identify 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 Info Type
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
Following Table AQ Registration Info Type Attributes
| Attribute |
Description |
| name |
Specifies the name of the subscription.
The subscription name is of the form . if the registration is for a single consumer queue and .: if the registration is for a multiconsumer queues. |
| namespace |
Specifies the namespace of the subscription.
To receive notifications from AQ queues the namespace must be DBMS_AQ.NAMESPACE_AQ.
To receive notifications from other applications via DBMS_AQ.POST or OCISubscriptionPost(), the namespace must be DBMS_AQ.NAMESPACE_ANONYMOUS. |
|
callback |
Specifies the action to be performed on message notification.
For email notifications, the form is mailto://xyz@company.com
For AQ PL/SQL Callback, use plsql://.?PR=0 for raw message payload OR
plsql://.?PR=1 for ADT message payload converted to XML |
| context |
Specifies the context that is to be passed to the callback function. Default: NULL |
AQ Notification Descriptor Type
The aq$_descriptor data structure specifies the AQ Descriptor received by the 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
Following Table AQ Notification Descriptor Type
| Attribute |
Description |
| 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 multi-consumer queue |
| msg_id |
Id of the message. |
| msg_prop |
Message properties. |
AQ Post Info Type
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
Table AQ Post Info Type Attributes
| Attribute |
Description |
| name |
name of the anonymous subscription to which you want to post to.
|
| namespace
|
To receive notifications from other applications via DBMS_AQ.POST or OCISubscriptionPost(), the namespace must be DBMS_AQ.NAMESPACE_ANONYMOUS. |
|
payload |
The payload to be posted to the anonymous subscription
Default: NULL
|
Enumerated Constants in the 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
Enumerated Constants in the 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
NIT.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
A parameter called AQ_TM_PROCESSES should be specified in the init.ora PARAMETER file if you want to perform time monitoring on queue messages. Use this for messages that have delay and expiration properties specified. This parameter can be set in a range from 0 to 10. Setting it to any other number will result in an error. If this parameter is set to 1, one queue monitor process (QMN) will be created as a background process. If the parameter is not specified, or is set to 0, the queue monitor process is not created.
JOB_QUEUE_PROCESSES Parameter
Propagation is handled by job queue (SNP) 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 1. The database administrator can set it to higher values if there are many queues from which the messages have to be propagated, or if there are many destinations to which the messages have to be propagated, or if there are other jobs in the job queue
The Java Advanced Queuing API supports both the administrative and operational features of Advanced Queuing. In developing Java programs for messaging applications, you will use JDBC to open a connection to the database and then use oracle.AQ, the Java AQ API for message queuing. This means that you will no longer need to use PL/SQL interfaces.
Previous Chapter | Next Chapter
More Articles
1. What Is Advanced Queuing?
2. General Features of Advanced Queuing
3. Enqueue, Dequeue, Propagation Features of Advanced Queuing
4. Elements of Advanced Queuing
More Tutorials on Oracle dba ...
Source :Oracle Documentation
Liked it ? Want to share it ? Social Bookmarking
Want to share or request Oracle Tutorial articles to become a Oracle DBA. Direct your requests
to
webmaster@oracleonline.info