You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Jira item: CPS-474 - Getting issue details... STATUS



Overview

For now, sending data updated event notifications from CPS Core is controlled at application level using "notification.data-updated.enabled" application property indicator.

For optimization and more fine grain control on the events that are published, there is a need to consider additional criteria within the notification process. One of these criteria is the dataspace. The requirement is to be able to publish notifications for data belonging to some specific dataspace and do not send any notifications for some other dataspaces.

The data updated configuration at application level has priority over the configuration at dataspace level. It means, no notification at all can be sent if the configuration is not enabled at application level, no matter which configuration is set at dataspace level.

Proposition

This proposition consists in extending current existing CPS concepts with additional properties to enable or disabling the notification for a specific instance.

For dataspace, it means adding a "data updated notification indicator" information to the entity.

Database Model

At database level, the following column is added to dataspace table:

  • Name: data_updated_notification_indicator
  • Type: boolean
  • Nullable: false
  • Default value: false

DataspaceEntity class is modified accordingly to have this new column added as an entity property.

Service Interface

At service layer, missing Dataspace model class is created to reflect the dataspace structure and to be mapped to DataspaceEntity.

→ Creation

To create a new dataspace the following interface method is added for CpsAdminPersistenceService class:

  • Dataspace createDataspace(@NonNull Dataspace);

If ever the interface is exposed externally, then existing "void createDataspace(@NonNull String dataspaceName)" method needs to be kept and its implementation changed to call the new method above with null of false notification indicator. The method can be made deprecated for future removal.

→ Modification

To update an existing dataspace a new method is created for CpsAdminPersistenceService class:

  • Dataspace updateDataspace(@NonNull Dataspace);

REST API

→ Creation

At REST API level, dataspace creation requires a new parameter for the notification indicator.

To keep the change as non breaking, the existing dataspace endpoint is kept unchanged:

  • POST - /cps/api/v1/dataspaces?dataspace-name=<name>

and its implementation is modified to create a dataspace with the default false value for "data-updated-notification-indicator".

Unfortunately this endpoint does not align with REST conventions and does not prepare for future changes. Then, redesigning the endpoint for improvement is considered:

  • POST - /cps/api/v2/dataspaces

with all payload information for the dataspace to be created provided in the HTTP request body ("dataspace-name" being mandatory and "data-updated-notification-indicator" optional):

{
  "dataspace-name": "<name>",
  "data-updated-notification-indicator": "<indicator>"
}

and the dataspace created is contained in the HTTP response body.

Both v1 and v2 endpoints could be supported for a transition period, with v1 marked as deprecated for future removal.

→ Modification

Dataspace modification requires a new endpoint:

  • PUT /cps/api/v2/dataspaces?dataspace-name=<name>

with all payload information for the dataspace to be created provided in the HTTP request body ("dataspace-name" being mandatory, consistent with the query parameter and "data-updated-notification-indicator" optional):

{
  "dataspace-name": "<name>",
  "data-updated-notification-indicator": "<indicator>"
}

and the dataspace modified is contained in the HTTP response body.

Service Processing

NotificationService class is changed to complete following checks in order to publish an event when a data node is updated:

  1. Data updated event notification is enabled at application level (notification.data-updated.enabled application property, already implemented)
  2. Data updated event notification is enabled for the dataspace the updated data belongs to (to be implemented)

All checks above needs to be successful to send the notification.

For performance optimization, caching dataspace information is considered to avoid requesting the database each time this information is needed.



  • No labels