Skip Headers

Oracle9i Application Developer's Guide - Advanced Queuing
Release 2 (9.2)

Part Number A96587-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

2
Basic Components

The following basic components are discussed in this chapter:

Data Structures

The following chapters discuss the Advanced Queuing administrative and operational interfaces in which data structures are used:

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 := [<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 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 := <object_type> | "RAW"

Usage

Table 2-1 lists usage information for type_name.

Table 2-1 Type Name (type_name)
Parameter Description

<object_types>

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 2-2 lists usage information for aq$_agent.

Table 2-2 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

Table 2-3 AQ Registration Info Type Attributes
Attribute Description
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 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 AQ PL/SQL Callback, use plsql://<schema>.<procedure>?PR=0 for raw message payload or plsql://<schema>.<procedure>?PR=1 for ADT message payload converted to XML

context

Specifies the context that is to be passed to the callback function. Default: NULL

Table 2-4 shows the actions performed when different notification mechanisms/presentations are specified for nonpersistent queues.

Table 2-4 Nonpersistent Queues
Queue Payload Type Presentation Specified
RAW XML
Notification Mechanism Notification Mechanism
LNOCI E-mail PL/SQL Callback LNOCI E-mail PL/SQL Callback

RAW

The callback receives the RAW data in the payload.

Not supported

The PL/SQL callback receives the RAW data in the payload.

The callback receives the XML data in the payload.

The XML data is formatted as a SOAP message and e-mailed to the registered e-mail address.

The PL/SQL callback receives the XML data in the payload.

ADT

Not supported.

Not supported.

Not supported.

The callback receives the XML data in the payload.

The XML data is formatted as a SOAP message and e-mailed to the registered e-mail address.

The PL/SQL callback receives the XML data in the payload.

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

Table 2-5 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 multiconsumer 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 2-6 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 using 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

Table 2-7 lists the enumerated constants.

Table 2-7 Enumerated Constants in the 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 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 2-8 lists the enumerated constants.

Table 2-8 Enumerated Constants in the 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

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 should be set to at least 1. It 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.

Table 2-9 lists parameter information.

Table 2-9 AQ_TM_PROCESSES Parameter
Parameter Options

Parameter Name

aq_tm_processes

Parameter Type

integer

Parameter Class

Dynamic

Allowable Values

0 to 10

Syntax

aq_tm_processes = <0 to 10>

Name of process

ora_qmn<n>_<oracle sid>

Example

aq_tm_processes = 1

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 2. 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.

See Also:

Oracle9i SQL Reference for more information on JOB_QUEUE_PROCESSES.

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.


Go to previous page Go to next page
Oracle
Copyright © 1996, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback