Skip to content

Commit 9ee8184

Browse files
committed
Notifications
1 parent f5c2314 commit 9ee8184

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-1
lines changed

src/content/features/namespaces.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import {Tabs} from 'nextra/components'
33
# Namespaces
44

55
Oxia can partition the data in different namespaces. Application can use namespaces to isolate different use cases
6+
and also have more visibility in the metrics, which are going to be labeled with the namespace as well.
67

7-
Each namespace has its own independent set of shards and
8+
Each namespace has its own independent key-space and set of shards.
89

910
## Using a namespace
1011

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import {Tabs} from 'nextra/components'
2+
3+
# Notifications
4+
5+
Oxia allows applications to get a feed of all the changes happening in a given namespace. This is
6+
similar to a database change-data-capture (CDC).
7+
8+
Once a notification object is created, a client is guaranteed to receive notification of
9+
all the changes happening in Oxia after that point, even in the presence of an arbitrary number
10+
of failures.
11+
12+
## Subscribing to notifications
13+
14+
<Tabs items={['Go', 'Java', 'CLI']}>
15+
<Tabs.Tab>
16+
```go
17+
notifications, err := client.GetNotifications()
18+
defer notifications.Close()
19+
20+
for notification := range notifications.Ch() {
21+
fmt.Println(notification)
22+
}
23+
```
24+
</Tabs.Tab>
25+
<Tabs.Tab>
26+
```java
27+
client.notifications(notification -> {
28+
System.out.println("Got notification: " + notification);
29+
});
30+
```
31+
</Tabs.Tab>
32+
<Tabs.Tab>
33+
```shell
34+
oxia client notifications
35+
```
36+
</Tabs.Tab>
37+
</Tabs>
38+
39+
### Notification event types
40+
41+
| Name | Description |
42+
|------------------------|----------------------------------------|
43+
| `KeyCreated` | A record that didn't exist was created |
44+
| `KeyModified` | An existing record was modified |
45+
| `KeyDeleted` | A record was deleted |
46+
| `KeyRangeRangeDeleted` | A range of keys was deleted |
47+
48+
Notification event fields:
49+
50+
| Name | Type | Description |
51+
|---------------|--------------------|--------------------------------------------------------------------------------------------------------------|
52+
| `Type` | `NotificationType` | The type of the modification |
53+
| `Key` | `string` | The Key of the record to which the notification is referring |
54+
| `VersionId` | `int64` | The current VersionId of the record, or -1 for a KeyDeleted event |
55+
| `KeyRangeEnd` | `string` | In case of a KeyRangeRangeDeleted notification, this would represent the end (excluded) of the range of keys |
56+
57+
## Disabling notifications
58+
59+
Notifications are enabled by default on namespaces. Since there is some overhead for preparing the notifications
60+
feed, if an application doesn't need this feature it can be disabled.
61+
62+
In the coordinator `config.yaml`, set `notificationsEnabled=false` on the specific namespace configuration.

0 commit comments

Comments
 (0)