Fix data update using scopes #824
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes Issue
Closes #773
In the current implementation publishing a data update using scopes doesn't work. This is due to issues with a missing prefixing of the topic.
Changes proposed
Current Faulty Setup
data:topic
(Missing prefix with scope id)scope:data:topic
(correct topic)Corrected Setup
scope:data:topic
scope:data:topic
Both topics need to be correct. The topic published to needs to be correct as the client only subscribes to the topic in the correct format and would ignore publications to the incorrect topic (format). The topic in the DataSourceEntry needs to be correct since with an incorrect topic the client will receive the message but discard it later due to an unknown topic in the entry.
To accomplish the corrected setup there are two changes necessary. The first is to prefix the topic with the scope id in the scope data update api endpoint. However in the ScopedDataPublisher the topic is prefixed with the scope id again. To avoid publishing to a topic with a duplicate prefix (
scope:scope:data:topic
) the ServerSideTopicPublisher is used instead of the ScopedTopicPublisher.Check List (Check all the applicable boxes)
Screenshots
n/a
Note to reviewers
n/a
EDIT: Used non scoped data topic publisher to avoid duplicate prefixing instead of modifying ScopedTopicPublisher to avoid interference with policy publishing.