diff --git a/docs/tutorial/DataNotification.md b/docs/tutorial/DataNotification.md index 132d9f2c1fd6d9f4b442e3c9eec6196f07517f7b..b7d23d80b97b6b4787cee38d191652c06a658211 100644 --- a/docs/tutorial/DataNotification.md +++ b/docs/tutorial/DataNotification.md @@ -33,10 +33,12 @@ The topics below describe these steps/APIs in detail that allow consumers to cre ### Get topics available to subscribe<a name="list-topics"></a> Consumer uses Data notification "topics" API to view the list of supported notification topics and corresponding sample messages. +Notice that now register is collaboration aware, which means when the consumer provides the "x-collaboration" header the list of topics returned will have a new topic "recordstopic-v2" which will receive notifications when "x-collaboration" header is provided. + ``` GET api/register/v1/topics ``` -<details><summary>curl</summary> +<details><summary>curl for a general request</summary> ``` curl --request GET \ @@ -47,7 +49,7 @@ curl --request GET \ ``` </details> -A sample output is shown below. Please note the "name" of the topic. This is required to create a Subscription for a topic you are interested in. +A sample output is shown below when the collaboration context header is not provided. Please note the "name" of the topic. This is required to create a Subscription for a topic you are interested in. <details><summary>Sample response</summary> @@ -134,6 +136,125 @@ A sample output is shown below. Please note the "name" of the topic. This is req </details> +<details><summary>curl for a collaboration context header provided request</summary> + +``` +curl --request GET \ + --url 'https://register-svc.osdu.com/api/register/v1/topics' \ + --header 'Authorization: Bearer <JWT>' \ + --header 'Content-Type: application/json' \ + --header 'data-partition-id: common' \ + --header 'x-collaboration: id=<collaboration id>,application=<application name>' \ +``` +</details> + +A sample output is shown below when the collaboration context header is provided. + +<details><summary>Sample response</summary> + +``` +[ + { + "name": "recordstopic", + "description": "This notification is sent whenever a new record or record version is created, updated or deleted in storage. 'previousVersionKind' is noted upon 'kind' update. Record deletion is noted as a soft 'deletionType'. Record purge is noted as a hard 'deletionType'.", + "state": "ACTIVE", + "example": [ + { + "id": "osdu:abc:123", + "kind": "osdu:petrel:regularheightfieldsurface:1.0.0", + "op": "create" + }, + { + "id": "osdu:abc:345", + "kind": "osdu:petrel:regularheightfieldsurface:1.0.1", + "op": "update", + "previousVersionKind": "osdu:petrel:regularheightfieldsurface:1.0.0" + }, + { + "id": "osdu:abc:567", + "kind": "osdu:petrel:regularheightfieldsurface:1.0.0", + "op": "delete", + "deletionType": "soft" + }, + { + "id": "osdu:abc:789", + "kind": "osdu:petrel:regularheightfieldsurface:1.0.0", + "op": "delete", + "deletionType": "hard" + } + ] + }, + { + "name": "schemachangedtopic", + "description": "This notification is sent whenever a new schema is created or updated via schema-service.", + "state": "ACTIVE", + "example": [ + { + "kind": "osdu:wks:wellbore:1.0.0", + "op": "update" + }, + { + "kind": "osdu:wks:wellbore:2.0.0", + "op": "create" + } + ] + }, + { + "name": "statuschangedtopic", + "description": "Every Service/Stage would publish their respective status changed information in this topic.", + "state": "ACTIVE", + "example": [ + { + "kind": "status", + "properties": { + "correlationId": "12345", + "recordId": "osdu:file:3479d828-a47d-4e13-a1f8-9791a19e1a7e", + "recordIdVersion": "1610537924768407", + "stage": "STORAGE_SYNC", + "status": "FAILED", + "message": "acl is not valid", + "errorCode ": 400.0, + "timestamp ": 1.622118996E12 + } + }, + { + "kind": "dataSetDetails", + "properties": { + "correlationId": "12345", + "dataSetId": "12345", + "dataSetIdVersion": "1", + "dataSetType": "FILE", + "recordCount": 10.0, + "timestamp ": 1.622118996E12 + } + } + ] + }, + { + "name": "recordstopic-v2", + "description": "This notification is sent whenever a new record or record version is created, updated or deleted in storage for all collaboration and non-collaboration context changes. The collaboration context will be provided as part of the message properties if exist. 'previousVersionKind' is noted upon 'kind' update. Record deletion is noted as a soft 'deletionType'. Record purge is noted as a hard 'deletionType'.", + "state": "ACTIVE", + "example": { + "message": { + "data": [ + { + "id": "osdu:abc:123", + "kind": "osdu:petrel:regularheightfieldsurface:1.0.0", + "op": "create" + } + ], + "account-id": "opendes", + "data-partition-id": "opendes", + "correlation-id": "4f1982a2-cbdf-438a-b5a1-e0c6239d46fc", + "x-collaboration": "id=1e1c4e74-3b9b-4b17-a0d5-67766558ec65,application=Test App" + } + } + } +] +``` + +</details> + [Back to Table of Contents](#TOC) ## Subscribing to a topic <a name="create-subscription"></a>