eclipse-emfcloud / emfcloud-modelserver

Modelserver component
Other
40 stars 21 forks source link

API v2: Subscription option for multi-resource update notifications #236

Open ndoschek opened 1 year ago

ndoschek commented 1 year ago

The incremental model update notifications in API v2 notify subscribers for patch entry per its corresponding patchModelUri separately. In the use case of a managed multi-resourceSet that contains a semantic as well as a notation resource, a client that subscribed with the semanticResourceUri won't get notified for pure notation changes.

Problem scenario: A diagram editor subscribes with the semanticResourceUri, notifications for adding/removing elements that affect both resources are received correctly once for the semanticResourceUri, usually followed by a refresh of the invovled models. If the Model Server executes pure notation changes (e.g. change of routing points or element bounds), it will only notify subscribers that subscribed to the notationResourceUri. In the case of the diagram editor, a first notation change seems valid as the command itself was successful, but the model beneath was not updated. On an undo the model does not get updated either. To the user it seems as if the undo/redo was not successful, but the Model Server executed the command correctly. If the user would close and re-open the diagram the correct model is displayed again.

Proposed solution: Adding a subscription option that the subscriber gets notified about the whole map of Json patch entries at once (and would have to filter possible unsuitable patches). In many current use cases we reload on incremental update notifications, hence the notification of the complete Json patch map for compound command changes is sufficient in this case. If the option is not set actively, this solution should not change the current behavior and will not force adopters to filter the patches.

This solution includes the update of the ModelServerClientAPI in the Java client as well as the ModelServerClients in the following repos as well: emfcloud-modelserver-theia and modelserver-node.