Oracle® Database PL/SQL Packages and Types Reference 11g Release 2 (11.2) Part Number E25788-04 |
|
|
PDF · Mobi · ePub |
The DBMS_STREAMS_MESSAGING
package, one of a set of Oracle Streams packages, provides interfaces to enqueue messages into and dequeue messages from a ANYDATA
queue.
This chapter contains the following topics:
Overview
Security Model
This section contains topics which relate to using the DBMS_CAPTURE_ADM
package.
This package provides interfaces to enqueue messages into and dequeue messages from a ANYDATA
queue.
Note:
Currently, messaging clients cannot dequeue buffered messages. In addition, theDBMS_STREAMS_MESSAGING
package cannot be used to enqueue messages into or dequeue messages from a buffered queue. However, you can use the DBMS_AQ
package to enqueue and dequeue buffered messages.See Also:
Oracle Database 2 Day + Data Replication and Integration Guide for more information about Oracle Streams and for an example that uses the procedures in this package
Oracle Streams Advanced Queuing User's Guide for more information about queues, messaging, and the DBMS_AQ
package
Security on this package can be controlled in either of the following ways:
Granting EXECUTE
on this package to selected users or roles.
Granting EXECUTE_CATALOG_ROLE
to selected users or roles.
If subprograms in the package are run from within a stored procedure, then the user who runs the subprograms must be granted EXECUTE
privilege on the package directly. It cannot be granted through a role.
To ensure that the user who runs the subprograms in this package has the necessary privileges, configure an Oracle Streams administrator and connect as the Oracle Streams administrator when using this package.
See Also:
Oracle Streams Replication Administrator's Guide for information about configuring an Oracle Streams administratorTable 148-1 DBMS_STREAMS_MESSAGING Package Subprograms
Subprogram | Description |
---|---|
Uses the specified Oracle Streams messaging client to dequeue a message from the specified queue |
|
The current user enqueues a message into the specified queue |
Note:
The subprograms in this package do not commit.This procedure uses the specified Oracle Streams messaging client to dequeue a message from the specified queue.
This procedure is overloaded. One version of this procedure contains the msgid
OUT
parameter, and the other does not.
DBMS_STREAMS_MESSAGING.DEQUEUE( queue_name IN VARCHAR2, streams_name IN VARCHAR2, payload OUT ANYDATA, dequeue_mode IN VARCHAR2 DEFAULT 'REMOVE', navigation IN VARCHAR2 DEFAULT 'NEXT MESSAGE', wait IN BINARY_INTEGER DEFAULT FOREVER, msgid OUT RAW); DBMS_STREAMS_MESSAGING.DEQUEUE( queue_name IN VARCHAR2, streams_name IN VARCHAR2, payload OUT ANYDATA, dequeue_mode IN VARCHAR2 DEFAULT 'REMOVE', navigation IN VARCHAR2 DEFAULT 'NEXT MESSAGE', wait IN BINARY_INTEGER DEFAULT FOREVER);
Table 148-2 DEQUEUE Procedure Parameters
Parameter | Description |
---|---|
|
The name of the local queue from which messages will be dequeued, specified as For example, to specify a queue named |
|
The name of the Oracle Streams messaging client. For example, if the user If |
|
The payload that is dequeued |
|
Specify one of the following settings:
|
|
The position of the message that will be retrieved. First, the position is determined. Second, the search criterion is applied. Finally, the message is retrieved. Specify one of the following settings:
Note: Each message group contains the messages in a single transaction. See Also: Oracle Streams Advanced Queuing User's Guide for more information about dequeue options |
|
Either If If |
|
The message identifier of the message that is dequeued |
Table 148-3 DEQUEUE Procedure Exceptions
Exception | Description |
---|---|
|
Dequeue has reached the end of the messages in the current transaction. Specify this exception in the following way: SYS.DBMS_STREAMS_MESSAGING.ENDOFCURTRANS Every dequeue procedure should include an exception handler that handles this exception. |
|
There are no more messages in the queue for the dequeue operation. Specify this exception in the following way: SYS.DBMS_STREAMS_MESSAGING.NOMOREMSGS A dequeue procedure that specifies |
This procedure enables the current user to enqueue a message into the specified queue.
This procedure is overloaded. One version of this procedure contains the msgid
OUT
parameter, and the other does not.
DBMS_STREAMS_MESSAGING.ENQUEUE( queue_name IN VARCHAR2, payload IN ANYDATA, msgid OUT RAW); DBMS_STREAMS_MESSAGING.ENQUEUE( queue_name IN VARCHAR2, payload IN ANYDATA);
Table 148-4 ENQUEUE Procedure Parameters
Parameter | Description |
---|---|
|
The name of the local queue into which messages will be enqueued, specified as For example, to specify a queue named |
|
The payload that is enqueued |
|
The message identifier of the message that is enqueued |
To successfully enqueue messages into a queue, the current user must be mapped to a unique Advanced Queuing agent with the same name as the current user. You can run the DBMS_STREAMS_ADM.SET_UP_QUEUE
procedure and specify a user as the queue user to grant the necessary privileges to the user to perform enqueues. The Advanced Queuing agent is created automatically when you run SET_UP_QUEUE
and specify a queue user.
See Also:
SET_UP_QUEUE Procedure