Skip to Content

Notifications

Oxia allows applications to get a feed of all the changes happening in a given namespace. This is similar to a database change-data-capture (CDC).

Once a notification object is created, a client is guaranteed to receive notification of all the changes happening in Oxia after that point, even in the presence of an arbitrary number of failures.

Subscribing to notifications

notifications, err := client.GetNotifications() defer notifications.Close() for notification := range notifications.Ch() { fmt.Println(notification) }

Notification event types

NameDescription
KeyCreatedA record that didn’t exist was created
KeyModifiedAn existing record was modified
KeyDeletedA record was deleted
KeyRangeRangeDeletedA range of keys was deleted

Notification event fields:

NameTypeDescription
TypeNotificationTypeThe type of the modification
KeystringThe Key of the record to which the notification is referring
VersionIdint64The current VersionId of the record, or -1 for a KeyDeleted event
KeyRangeEndstringIn case of a KeyRangeRangeDeleted notification, this would represent the end (excluded) of the range of keys

Disabling notifications

Notifications are enabled by default on namespaces. Since there is some overhead for preparing the notifications feed, if an application doesn’t need this feature it can be disabled.

In the coordinator config.yaml, set notificationsEnabled=false on the specific namespace configuration.

Last updated on