fiware-orion icon indicating copy to clipboard operation
fiware-orion copied to clipboard

onlyChangeAttrs should take into account "entityUpdate" in "alterationTypes"

Open fgalan opened this issue 2 years ago • 4 comments

It comes from https://github.com/telefonicaid/fiware-orion/issues/1494#issuecomment-1181656637

onlyChangedAttrs should take into account the alterationTypes, so if alterationTypes includes entityUpdate then it is interpreted in the following way: "include only attributes that are included in the update, no matter if there was an actual update or not".

Currently onlyChangedAttrs has implicitely the change semantics so it is interpreted always as "include only attributes that change", so if "alterationTypes": [ "entityUpdate" ] it doesn't notify attributes that not actually change.

CC: @djs0109

fgalan avatar Aug 26 '22 11:08 fgalan

Hi @fgalan sir,

I would like to work on this issue. As per my understanding currently if alterationTypes": [ "entityUpdate" ] it notify no matter if there was an actual update or not.

We need to add condition for if alterationTypes": [ "entityUpdate" ] it will only notify when attributes actually change. Please confirm my understanding.

Anjali-NEC avatar Aug 30 '22 07:08 Anjali-NEC

@Anjali-NEC note this issue is not about alterationTypes including entityUpdate. That feature is already developed and works.

This issue is about onlyChangedAttrs. If alterationTypes includes entityUpdate and onlyChangedAttrs is set to true then the notification must include only the attributes in the update and no matter if there was an actual change or not in these attributes in the entity.

I hope to have clarified the issue... @djs0109 please feel free to comment if your understanding is other or you want to provide some feedback.

Thank you for your willingness to work on this issue! I have assigned it to you.

fgalan avatar Aug 31 '22 15:08 fgalan

Exactly, what I expect is, when alterationTypes includes entityUpdate, the subscription should also be triggered if there is no actual change. However, this seems to be blocked by onlyChangedAttrs=true.

By the way, I notice that, if onlyChangedAttrs=true, the subscription can still be triggered, when I use forcedUpdate option in request. Based on this, a possible solution could be: if alterationTypes includes entityUpdate, automatically append options=forcedUpdate in request parameters. Just an idea, maybe it is not elegant :)

djs0109 avatar Sep 01 '22 06:09 djs0109

By the way, I notice that, if onlyChangedAttrs=true, the subscription can still be triggered, when I use forcedUpdate option in request. Based on this, a possible solution could be: if alterationTypes includes entityUpdate, automatically append options=forcedUpdate in request parameters. Just an idea, maybe it is not elegant :)

I agree is not very elegant ;) Thus, I'll suggest to fix this in the "core" of onlyChangedAttrs funcionality, not "patching" the request internally.

fgalan avatar Sep 01 '22 08:09 fgalan