...
Jira | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Issues & Decisions
# | Issue | Notes | Decisions |
---|---|---|---|
1 | Use anchor objects instead of just the anchor names. ( this is to make sure the YANG schema is flexible enough and also same in the REST side) | Requires we agree on the REST endpoint and request body and corresponding YANG schema to store the metadata. | |
2 | Wildcard character to subscribe/unsubscribe all the anchors in a given dataspace. | Need to agree on the wildcard character. Propose to have a single ["*"] to subscribe or unsubscribe. | |
Description
We want to implement a granular approach to control cps notifications. it will help in performance improvement by suppressing the unwanted messages in Kafka message stream
...
URL : PUT http://<IP:PORT>/cps/v2/dataspaces/{dataspace-name}/notification-subscription/{subscription}
Query Parameters:
Parameter | Description |
---|---|
dataspace-name | dataspace name |
subscription | subscribe or unsubscribe |
...
Information about the subscription of notification will be persisted in Fragment table. For Example, if the notification is subscribed unsubscribed by anchor_id 28, fragment table will have below entry
...
The above entry from fragment table will be deleted when anchor is unsubscribed from subscribed to notification.
Attributes field is empty because we don't need any further granular control of notification. In future if we need to implement further granular control of notification, we can use attributes fields
Persistence using NEW dedicated YANG schema
APIs | Description |
---|---|
POST http://<IP:PORT>/cps/v2/notification-subscription | subscribe cps notification |
DELETE http://<IP:PORT>/cps/v2/notification-subscription | unsubscribe cps notification |
Parameters
Parameter | In | Description |
---|---|---|
xpath | Query | xpath of the dataspace/anchor to be subscribed or unsubscribed |
We can create different dataspace and anchor specially for cps notification to persist notification subscription information. We propose to create below dataspace, schema and anchor for notification subscription.
Entity | Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Dataspace Name | CPS-Admin | ||||||||||||||
Anchor Name | cps-notification-subscription | ||||||||||||||
schema set | cps-notification-subscription | ||||||||||||||
cps-notification-subscriptions@2024-06-18.yang |
|
When Notification is subscribed unsubscribed for above payload, below records will be added in fragment table.
dataspace01 : all anchors subscribed
dataspace02: list of anchors subscribed
dataspace03: list of anchors and xpaths subscribed
id | xpath | attributes | anchor_id | parent_id | schema_node_id | |
---|---|---|---|---|---|---|
1 | /dataspaces | {} | 6 | |||
2 | notification-subscription/dataspaces/dataspace[@name='dataspace01']ds02'] | {"name": "ds02", "subscriptionIds": ["0"]} | 6 | 1 | ||
32 | /notification-subscriptiondataspaces/dataspacesdataspace[@name='dataspace02']/anchorsds01'] | {"name": "ds01", "subscriptionIds": ["0", "1"]} | 6 | 1 | ||
4 | /dataspaces/dataspace[@name='anchor01ds01']/anchors | {} | 6 | 3 | ||
5 | /notification-subscriptiondataspaces/dataspacesdataspace[@name='dataspace02ds01']/anchors/anchor[@name='anchor02anchor01'] | {"name": "anchor01"} | 6 | 4 | ||
6 | /notification-subscriptiondataspaces/dataspacesdataspace[@name='dataspace03ds01']/anchors/anchor[@name='anchor01']/xpaths | {} | 6 | [. "/bookstore/categories[@code='01", "/bookstore/categories[@code='02" ] | 65 | |
7 | /dataspaces/dataspace[@name='ds01']/anchors/anchor[@name='anchor01']/xpaths/xpath[@path='/xpath'] | {"path": "/xpath"} | 6 | 6 |
Notification scenarios
Scenario | Description | |
---|---|---|
1 | day 0 |
|
2 | enable notification for a dataspace and all of its anchors | xpath '/dataspaces/dataspace[@name='ds-name']' and attributes '{"name": "ds01", "subscriptionIds": ["0"]}' will be added |
3 | when a new dataspace will be created | notification will be disabled for newly created dataspace. clients need to subscription API to enable notification |
4 | when a new anchor will be created | for newly created anchors notification will be disabled. clients need to call subscription API to enable notification for newly created anchor |
5 | Disable notification for whole dataspace | all notifications for the dataspace will be disabled. |
6 | Disable notification for specific anchor | If notification is subscribed for the anchor than client can disable notifications for the Anchor |
7 | Enable notification for dataspace and disable for few anchors | First Anchors should be subscribed than only client can unsubscribe notification for the Anchor. |
8 | notification subscription for same dataspace or anchor using different subscription ids. | subscription ids will be updated in attributes field (future scope) for similar subscriptions. |
9 | when a new dataspace or anchor added | notification will be disabled for newly created dataspace or anchor. |
Schema v/s non-schema persistence
Using Schema | Without Schema |
---|---|
Pros:
Cons:
| Pros:
Cons:
|
...