-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid triggering notification if metadata changes but not the attribute value itself #3727
Comments
Hi @fgalan Sir, Please confirm this issue need to be fixed? if yes then I will try to analyze and start working on it. |
"notifyOnMetadataChange" might be a better name. |
Yes, as far as I understand, this issue is still valid. Thanks for your willingness to work on it! With regards to the name of the field, |
As per my understanding we need to add an optional bool field Please confirm my understanding and assign this issue to me. |
Sounds good to me. What should be the default value for "notifyOnMetadataChange" ? |
@Anjali-NEC analysis sounds also good to me. Regarding the default for notifyOnMetadataChange I agree it should be the one that match with current behaviour to avoid backward compatibility problems. |
@fgalan sir, I have added bool field
But I have no idea how to get the value of |
In my opinion, in that part of the code you could detect if the entity has changed its attributes or only has changed metadata. Maybe you could transform actualUpdate in an enum with three values: None, onlyMetadata, value. Next, you should manage to pass back that information and use it to filter out subscriptions that doesn't match the criteria. You can do it in one of these two points:
This section in the development manual may be useful to get an idea of the overall update entity program flow. I hope this comment helps you in the implementation of this feature. |
Hi @fgalan sir, |
@fgalan |
Hi @fgalan, I'm working on it, and soon I will upload a diff. |
Great! Thanks for your contribution! :) |
Hi @fgalan, It's a strange thought, in my opinion. When I only change an entity's metadata, the attribute value is set to "null," and the value type is set to "None." as I've seen in master branch code. Do you think this is correct? Below is a detailed explanation. Step 1: Entity Creation
Step 2: Update Entity
Step 3: The updated Room1 entity output is shown below
|
With regards to step 2:
Take into account what it said in this section of the documentation about Partial Representation (i.e. when some of the elements in the request is missing) https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/orion-api.md#partial-representations:
That means an implicit In addition, it is said:
That means an implicit Thus, step 2 request is equivalent to:
Which is consistent with result in step 3. Note that at the present moment, NGSIv2 API doesn't include operations to manage metadata (i.e. adding a metadata without touching the attribute value). There is an issue about it (#2567) that is open to contributions. |
Currently, the metadata of an attribute is considered part of its value. Thus, a subscription using a given attribute as a triggering condition will trigger notifications in cases in which the attribute value doesn't change but metadata does. This is precluding some use cases.
Thus, in order to increase the flexibility of the subscription, this case should be allowed. The simpler approach seems to use a global general setting in the subscription condition (i.e.
"metadataAreNotPartOfValue": false
:) so notifications are sent only if the value of the attribute itself changes.Although maybe is a too "coarse-grained" solution and other approaches are possible...
The text was updated successfully, but these errors were encountered: