WIP
Introduction
- CPS Temporal is a dedicated service, distinct and decoupled from CPS Core (separated option #4 from CPS-78: Deployment View).
- Integration between Core and Temporal is event notification based, asynchronous, send and forget. By doing this, we are avoiding the dependency from CPS Core on CPS Temporal and its API. Actually, it reverses the dependency, which makes more sense from a conceptual point of view.
- For each data modification handled by CPS Core,
- CPS Core is publishing, to a dedicated topic, an event representing the data configuration or state.
- CPS Temporal is listening to the same topic for the event and is responsible to keep track of all data over time.
- In the future, some other services can be created to listen to the same topic in order to implement additional functionalities or storage forms.
- The event messaging system for this integration is either DMAAP or Kafka (to be deployed independently of CPS). The choice between one of the two is made by configuration when deploying CPS services.
- Events published by CPS Core contains following information:
- Timestamp
- Dataspace
- Schema set
- Anchor
- Data (complete json data payload)
- A contract is defined to make the expected information explicit for the publisher and all subscribers. This contract can be provided by a structured event schema format using Protobuf, Avro or JSON.
Architecture Diagrams
Following diagrams are C4 model diagrams (context, containers and components) for CPS Temporal.
(All of them can be seen by navigating thru diagrams tabs using arrows)
Data Updated Event Schema
The structure to represent a Data Updated Event for CPS point of view need to to be defined without any ambiguity. This the interface contract to be rely on for:
- CPS Core to publish data updates
- CPS Temporal to listen to data updates
- Any other system listening to data updates
CPS Data Updated Event is a JSON document that adheres to following JSON Schema:
cps-data-updated-event-schema.json
{ "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "urn:cps:org.onap.cps:data-updated-event-schema:1.0.0-SNAPSHOT", "$ref": "#/definitions/CpsDataUpdatedEvent", "definitions": { "CpsDataUpdatedEvent": { "title": "CpsDataUpdatedEvent", "description": "A CPS data updated event.", "type": "object", "properties": { "schema": { "const": "urn:cps:org.onap.cps:data-updated-event-schema:1.0.0-SNAPSHOT", "description": "The schema, including its version, that the event adheres to." }, "id": { "type": "string", "description": "The unique id identifying the event for the specified source. Producer must ensure that source + id is unique for each distinct event." }, "source": { "type": "string", "format": "uri", "description": "The source of the event. Producer must ensure that source + id is unique for each distinct event." }, "type": { "type": "string", "description": "The type of the event." }, "content": { "$ref": "#/definitions/Content" } }, "required": [ "schema", "id", "source", "type", "content" ], "additionalProperties": false }, "Content": { "title": "Content", "description": "The event content.", "type": "object", "properties": { "timestamp": { "type": "string" }, "coreReferences": { "$ref": "#/definitions/CoreReferenceList" }, "data": { "$ref": "#/definitions/Data" } }, "additionalProperties": false }, "CoreReferenceList": { "title": "CoreReferenceList", "description": "All CPS Core references for data.", "type": "object", "properties": { "dataspace": { "$ref": "#/definitions/CoreReference" }, "schemaSet": { "$ref": "#/definitions/CoreReference" }, "anchor": { "$ref": "#/definitions/CoreReference" } }, "additionalProperties": false }, "CoreReference": { "title": "CoreReference", "description": "A CPS Core reference for data.", "type": "object", "properties": { "id": { "type": "string", "description": "The unique id identifying the reference." }, "name": { "type": "string", "description": "The name of the reference." } }, "additionalProperties": false }, "Data": { "title": "Data", "description": "The json data content payload", "type": "object" } } }
Following is a CPS Data Updated Event example:
cps-data-updated-event.json
{ "schema": "urn:cps:org.onap.cps:data-updated-event-schema:1.0.0-SNAPSHOT", "id": "38aa6cc6-264d-4ede-b534-18f5c1f403ea", "source": "urn:cps:org.onap.cps", "type": "org.onap.cps.data-updated-event", "content": { "timestamp": "2020-12-01T00:00:00.000+0000", "coreReferences": { "dataspace": { "id": "123", "name": "my-dataspace" }, "schemaSet": { "id": "456", "name": "my-schema-set" }, "anchor": { "id": "789", "name": "my-anchor" } }, "data": { "interface": { "name": "itf-1", "status": "up" } } } }