-
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
More granular subscriptions modes (create only, update only, delete only and combinations) #1494
Comments
Not sure if we talk about the same thing, but
Anyway, I think what you propose is to define different subscription modes in order to
|
A way of specifying to which case (update, create, delete) a given attribute in the notification corresponds (see It is a just a matter on how to "code" that configuration in the subscripton payload. |
We need to distinguish between actions referring to entities and actions referring to attributes. I guess that if attrs is not defined or empty we will be referring to the whole entity and if not we will be referring to a particular attribute or attributes.
The difference between update and change would be that change will imply a change in the attribute value whereas update will imply an update of the element which could result in a attribute value change or not. For backwards compatibility, no actionType will mean "change". What do you think? |
Note from #2518 (comment), to take into account in the context of this issue:
|
Functional specification Based on the @jmcanterafonseca idea, but with some changes:
(triggering attributes = the ones in The .apib file needs to be modified accordingly to describe the new fields. |
Implementation notes: Have a loook to the
|
Out of the scope of NGSIv2, althouth it is a good idea that could (potentially) be included in a later version of the API (v2.1) in a backward compatible way. |
The following post in SOF should be edited upon issue completion: https://stackoverflow.com/questions/54220061/orion-subscriptions-do-not-detect-the-removal-of-entities |
Currently, each notification includes the attributes About telefonicaid/fiware-cygnus#1415, Cygnus could save this value to a new field named |
New functional specification:
In the future maybe we could consider attribute-based |
Agreed. We will use |
With regards to
In principle we are going to take option 2 |
|
PR #4084 |
@kzangeli As discussed in the previous TSC, this is the Issue for implementing subscriptions notifications. It would be interesting to be aligned with further implementations in NGSI-LD. Take into account that this new parameter is going to be included under You can have a look to the tests implemented in PR #4084 to have a clear idea about how is expected to work. |
|
We are going to split the implementation in two PRs:
Note however that the tests included in PR #4084 already include entityStatus in subscription creation, so they will be reused for step 2. |
Taking into account this rename maybe the best name for the new built-in attribute would be |
PR #4091 completes this feature |
Hello, this new feature is really helpful for my use case, where my IoT "sensor" sometimes sends measurements with the unchanged values, but I still want to trigger the notification in this case. I found that My subscription:
The problem I found is that, the subscription can be triggered by a "PUT" request without actual change but not a "PATCH" request. However, IoTagent seems always send a "PATCH" request. |
Could you provide examples of the PUT and PATCH requests (verb + URL + payload) do you refer so I can test, please? |
Yes sure. You can test with the following 4 steps.
|
I have modeled a new .test based in your case (see PR #4172) and it seems it is working... In my case I'm getting 2 notifications. Note subscription is not exactly as yours, I have simplified removing some fields. I propose a kind of "mutual cross-check":
|
Additional question, pls: which Orion version are you using? I mean, the result of |
It is a
|
I have found that if I add "temperature" attribute to condition at subscription creation:
then both PUT and PATCH fail to generate notifications (which it is not exactly the same as you reported, as PUT is not working) I'll have a look |
It is still not working with the example above. But when I set the "onlyChangedAttrs" to |
I can confirm "onlyChangedAttrs" set to |
Looking into this, I think is correct behaviour. On the one hand, with regards to
So, according to this, the notification would be triggered in both PUT and PATCH cases in your use case. However, at the same time, with regards to
Thus, given the attribute Thus, the notification should be triggered, but, at the same time it shouldn't include any attribute. In this situation (a notification but without actual content) Orion doesn't send anything (which I think makes sense: it is a waste of resources to send just an "envelope" without any data). In your use case, you have only one attribute in the notification attribute list (apart from
thus I think |
@fgalan thank you for the explanation! I agree with you. In this regard the behavior definitely makes sense. In my use case for example, there is a room entity, which has temperature, humidity, co2 concentration, etc. as attributes. It should receive measurements from the sensors and I want to save these measurements to CrateDB in a reasonable manner, i.e. to save and only to save the actual signals. Therefore, I first need the And then I also need the It would be very helpful, if this behavior is possible. |
Not sure of understanding your use case... So, you have a given entity Room1 with several attributes temperature, humidity, co2 concentration, etc. Let's assume at a given moment the temperature is 24. Then, CB received update Room1 temperature to 24 (i.e. same value). What do you expect?
|
In this case, I will expect the CB to only notify temperature = 24. And if 5 minutes later, the temperature sensor sends another measurement with the same value. I will still expect the CB to only notify temperature = 24. So, all and only the real measurements are saved into time series. |
Under my understanding, you can achieve this use case without using |
Yes, I still need
Let's assume that, at this moment, the room entity has the following status: |
What about using
In the same situation you describe, CB will notify with |
Unfortunately, it does not work for me. I then also look into the CB docs, and found that the |
Not sure what do you mean by "attributes that not exist". Could you elaborate a bit more on why do you think this solution is not valid for your case? |
That is the description in the docs. I have tested with |
You are right. I missed that covered notifications take attributes from the entity not from the update triggering notification. What you are proposing is indeed a new feature. I have created a new fresh issue about it: #4202. Please, comment on that issue if the description I've provided there is not correct. |
NGSIv1 uses ONCHANGE notifications, which triggers each time a new context element (entrity + attribute) is created and/or updated. Thus, it is not granular enough to difference between create and update and it is not able to trigger notifications upon context element deletion.
NGISIv2 should improve this and include the following modes:
In addition, notifications should include some way of specifying if the context element was created, updated or deleted.
The
condition
field in NGSIv2 subscriptions should be reviewed in order to see how it can be adapted to these behaviours.(Mabye there are duplicate issues about ONCREATE or ONDELETION semantics...)
The text was updated successfully, but these errors were encountered: