Send Messages to OCI Notifications Service from Autonomous Database

Describes how to send messages from Autonomous Database to an OCI Notifications service topic.

The subscriptions you configure with the OCI Notifications service determine endpoints for a topic. Published messages are sent to each subscription for a topic. There are a number of supported subscription protocols, including: email, function, and Slack. See Overview of Notifications for more information.

When you use the OCI Notifications service with DBMS_CLOUD_NOTIFICATION package, only the DBMS_CLOUD_NOTIFICATION.SEND_MESSAGE procedure is supported (the DBMS_CLOUD_NOTIFICATION.SEND_DATA procedure is not supported).

Prepare to Send OCI Notifications from Autonomous Database

To send notifications to topics in OCI Notifications service, first create topics and subscriptions in OCI Notifications.

As a prerequisite, before you send messages with OCI Notifications, do the following:

  1. Create an OCI Notifications topic.

    See Creating a Topic for details on creating a topic.

  2. Create OCI Notifications subscriptions.

    See Creating a Subscription for details on creating a subscription.

    The subscriptions you configure determine endpoints for a topic. Published messages are sent to each subscription for a topic. There are a number of supported subscription protocols, including: email, function, and Slack.

    See Overview of Notifications for more information.

  3. After you create the OCI Notifications subscriptions, confirm the subscriptions.

    You can only publish messages to confirmed subscriptions. See Confirming a Subscription for details on confirming subscriptions.

Send Messages to an OCI Notifications Topic

Describes the steps to send messages to an OCI Notifications service topic.

  1. Create a topic and create subscriptions.
  2. Create a credential object to access OCI Notifications service from Autonomous Database.

    You can use either Oracle Cloud Infrastructure signing key credentials or resource principal credentials.

    • Create Oracle Cloud Infrastructure signing key credentials. For example:

      BEGIN
         DBMS_CLOUD.CREATE_CREDENTIAL (
             credential_name => ‘OCI_KEY_CRED’,
             user_ocid       => ‘ocid1.user.oc1..aaaaaaaauq54mi7zdyfhw33ozkwuontjceel7fok5nq3bf2vwetkpqsoa’,
             tenancy_ocid    => ‘ocid1.tenancy.oc1..aabbbbbbaafcue47pqmrf4vigneebgbcmmoy5r7xvoypicjqqge32ewnrcyx2a’,
             private_key     => ‘MIIEogIBAAKCAQEAtUnxbmrekwgVac6FdWeRzoXvIpA9+0r1.....wtnNpESQQQ0QLGPD8NM//JEBg=’,
             fingerprint     => ‘f2:db:f9:18:a4:aa:fc:94:f4:f6:6c:39:96:16:aa:27’);
      END;
      /

      See CREATE_CREDENTIAL Procedure for more information.

    • Create resource principal credentials and policies.

      See Use Resource Principal to Access Oracle Cloud Infrastructure Resources for more information.

  3. Send a message.
    • Send a message using Oracle Cloud Infrastructure signing key credentials:

      BEGIN
          DBMS_CLOUD_NOTIFICATION.SEND_MESSAGE(
              provider         => 'oci',
              credential_name  => 'OCI_KEY_CRED',
              message          => 'Text message',
              params           => json_object('topic_ocid' value 'oci********pa',
                                              'title'value 'Title for message'));
      END;
      / 
    • Send a message with resource principal credentials:

      BEGIN
          DBMS_CLOUD_NOTIFICATION.SEND_MESSAGE(
              provider         => 'oci',
              credential_name  => 'OCI$RESOURCE_PRINCIPAL',
              message          => 'Text message',
              params           => json_object('topic_ocid' value 'oci********pa',
                                              'title'      value 'Title for message'));
      END;
      / 

    With the oci provider there are different possible endpoints for a message, based on the subscriptions. The title parameter is treated differently for different subscription protocols:

    • email: The title specifies the subject line of the message.
    • Slack: The title value is not used. If it is included the value is ignored.

See SEND_MESSAGE Procedure for more information.

Limitations for Notifications with OCI Notifications Service

There are limitations when you use DBMS_CLOUD_NOTIFICATION to send messages and you use the oci provider (OCI Notifications service).

Note the following limitations:

  • Message Size Limit: The message size limit per request is 64KB. Messages exceeding this size cannot be sent or processed within a single request.
  • Message Delivery Rate Limit: There are different message delivery rate limits depending on the protocol used.
    • email protocol: the limit is 10 messages per minute per endpoint.

    This restriction may impact the speed at which messages can be transmitted and received.

  • Transactions Per Minute (TPM) per-tenancy Limit: There is a TPM limit of 60 per topic for this operation. This limit represents the maximum number of messages per minute that can be processed or handled for a given topic. Exceeding this limit may result in messages not being processed or processed at a slower rate.
  • The the Autonomous Database instance, the credential, if you are using user credentials, and the subscription topic must all be located in the same region.

See Overview of Notifications for more information on OCI Notifications.