Use Persistent Messaging with Messages Stored in Cloud Object Store
The
DBMS_PIPE
package has extended functionality on Autonomous Database to support persistent
messaging, where messages are stored in Cloud Object Store.
- About Persistent Messaging with DBMS_PIPE
Persistent messaging withDBMS_PIPE
allows one or more database sessions to communicate in the same region or across regions with messages that are stored in Cloud Object Store. - Create an Explicit Persistent Pipe and Send a Message
Describes the steps to create a persistent pipe with a specified pipe name (Explicit Pipe). - Retrieve a Persistent Message on Same Database
Describes the steps to retrieve a persistent message from an explicit pipe on the same Autonomous Database instance (the instance where the message was sent). - Retrieve a Persistent Message by Creating a Pipe on a Different Database
Describes the steps to retrieve a persistent message stored in Cloud Object Store with an explicit pipe on an Autonomous Database instance that is different than the instance that sent the message. - Remove a Persistent Pipe
Describes the steps to remove a persistent pipe.
About Persistent Messaging with DBMS_PIPE
DBMS_PIPE
allows one or more database
sessions to communicate in the same region or across regions with messages that are
stored in Cloud Object Store.
Persistent messages in DBMS_PIPE
:
-
Allow you to send and retrieve very large messages.
-
Support a sending a large number of pipe messages.
-
Support sending and receiving messages within a single database, across multiple databases and across databases in different regions.
-
Support multiple pipes using the same Cloud Object Store location URI.
Persistent messaging pipes can be created in any of the supported
DBMS_PIPE
types:
- Implicit Pipe: Automatically created when a message is sent with
an unknown pipe name using the
DBMS_PIPE.SEND_MESSAGE
function. - Explicit Pipe: Created using the
DBMS_PIPE.CREATE_PIPE
function with a user specified pipe name. - Public Pipe: Accessible by any user with
EXECUTE
permission onDBMS_PIPE
package. - Private Pipe: Accessible by sessions with the same user as the pipe creator.
Oracle recommends creating an explicit pipe before you send or receive messages with persistent messaging. Creating an explicit pipe with
DBMS_PIPE.CREATE_PIPE
ensures that the pipe is created with
the access permissions you want, either public or private (by setting the
private
parameter).
The following shows the general workflow for DBMS_PIPE
with
persistent messaging:
Existing applications using DBMS_PIPE
can continue to
operate with minimal changes. You can configure existing applications that use
DBMS_PIPE
with a credential object and location URI using a logon
trigger or using some other initialization routine. After setting the
DBMS_PIPE
credential and location URI, no other changes are needed
to use persistent messaging. All subsequent use of the pipe stores the messages in Cloud
Object Store instead of in database memory. This allows you to change the storage method
for messages from in-memory to persistent Cloud Object Storage, with minimal
changes.
Persistent Messaging Overview and Features
Features of DBMS_PIPE
using persistent messaging:
-
Messages can be sent and retrieved across multiple Autonomous Database instances in the same region or across regions.
-
Persistent messages are guaranteed to either be written or read by exactly one process. This prevents message content inconsistency due to concurrent writes and reads. Using a persistent messaging pipe,
DBMS_PIPE
allows only one operation, sending a message or a receiving message to be active at a given time. However, if an operation is not possible due to an ongoing operation, the process retries periodically until thetimeout
value is reached. -
DBMS_PIPE
usesDBMS_CLOUD
to access Cloud Object Store. Messages can be stored in any of the supported Cloud Object Stores. See DBMS_CLOUD URI Formats for more information. DBMS_PIPE
usesDBMS_CLOUD
to access Cloud Object Store and all supported credential types are available:DBMS_CLOUD.CREATE_CREDENTIAL
: See CREATE_CREDENTIAL Procedure for more information.
DBMS_PIPE Privileges Authorization and Security
The DBMS_PIPE
procedures run with invoker's rights.
Private pipes are owned by the current user and a private pipe that is created by a
user can only be used by the same user. This applies to both in-memory pipes and
persistent messaging pipes where messages are stored to Cloud Object Store. Sending
and receiving messages run in the invoker's schema.
Using private pipes, where messages are stored to Cloud Object Store, a
credential object is required for authentication with the Cloud Object store
identified by the location_uri
parameter. The invoking user must
have EXECUTE
privilege on the credential object specified with the
credential_name
parameter that is used to access the Object
Store.
To use a public pipe, the user, database session, must have execute
privilege on DBMS_PIPE
. For a public pipe using persistent
messaging and storing messages to Cloud Object Store, the user, database session,
must have execute privilege on DBMS_CLOUD
and execute privilege on the credential
object (or you can create a credential object that is allowed to access the location
URI that contains the message.
DBMS_PIPE Limitation
The DBMS_PIPE
package does not support sending messages between
databases that use different character sets. For example, if you have one Autonomous Database instances that uses
AL32UTF8 and another instance that uses WE8MSWIN1252, you cannot send messages with
DBMS_PIPE
between these two databases. In this case, you the
system will raise the error ORA-12704
if you attempt to send
messages with DBMS_PIPE
between these two databases.
See Choose a Character Set for Autonomous Database for more information.
Create an Explicit Persistent Pipe and Send a Message
Describes the steps to create a persistent pipe with a specified pipe name (Explicit Pipe).
Retrieve a Persistent Message on Same Database
Describes the steps to retrieve a persistent message from an explicit pipe on the same Autonomous Database instance (the instance where the message was sent).
On an Autonomous Database
instance you can receive messages sent to a pipe from a different session. The
DBMS_PIPE
procedures are invoker's rights procedures and run as
the current invoked user.
Private pipes are owned by the current user that creates the pipe. Private pipes can only be accessed by the same user that created the pipe. This applies to pipes using in-memory messages and to pipes using persistent messaging with messages stored in Cloud Object Store.
Public pipes can be accessed by any database session having execute
privilege on DBMS_PIPE
. This applies to pipes using in-memory
messages and to pipes using persistent messaging with messages stored in Cloud
Object Store.
See SET_CREDENTIAL_NAME Procedure and SET_LOCATION_URI Procedure for more information.
See RECEIVE_MESSAGE Function for more information.
Retrieve a Persistent Message by Creating a Pipe on a Different Database
Describes the steps to retrieve a persistent message stored in Cloud Object Store with an explicit pipe on an Autonomous Database instance that is different than the instance that sent the message.