Best Practices for Your Subscriptions and Topics
This topic covers best practices related to subscriptions and topics .
Avoid entering confidential information when assigning descriptions, tags, or friendly names to your cloud resources through the Oracle Cloud Infrastructure Console, API, or CLI.
Prevent Processing of Duplicate Items
As depicted at Flow of Message Publication, an event, alarm , or direct publication can trigger a message . The Notifications service then sends the message to many types of subscriptions, including email, HTTPS endpoints, and functions.
Depending on your goals, you may want to prevent your system from processing duplicate messages from a given message trigger. This situation is especially relevant when messages are sent to function subscriptions, which can result in double invocations. (For an example of a function subscription, see Scenario A: Automatically Resize VMs.)
To prevent your system from processing duplicate messages, write code that de-duplicates received messages by using identifiers specific to the trigger:
- For any message, consider using a custom de-dupe key entered in the body of the message.
- For alarm-triggered messages, use a combination of
timestampEpochMillisfrom the alarm message.
- For event-triggered messages, use
eventIDfrom the event message.
- For directly published messages, use
x-oci-ns-messageidin the header (provided by Notifications).
For handling duplicate requests sent to Oracle Cloud Infrastructure API endpoints, see Retry Token.
For related troubleshooting information, see Troubleshooting Notifications.