telefonicaid / fiware-orion

Context Broker and CEF building block for context data management, providing NGSI interfaces.
https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/orion-api.md
GNU Affero General Public License v3.0
210 stars 265 forks source link

Issue in notification process #1680

Closed marc0f closed 3 years ago

marc0f commented 8 years ago

Hi, I'm using 3 FIWARE GEs: IDAS+Orion+CEP. I have a device registered via IDAS with several attributes (status, temperature, battery, etc.) and a subscription from Orion to Proton. The subscrition is triggered by ONCHANGE of 'status', and all the device attributes are included in the notification message. I periodically send to IDAS the new measurements/values for all the attributes by using the UL2.0 with a paylaod as: 's|true#t|23#b|2.5#...'

I noticed that CEP does not always receive the latest value of the attributes, instead the value of the trigger attribute is alway correct. Therefore, a checked the notification messages, and it is like the notifications were sent before all the attributes were updated. I don't know if this is the normal behaviour or something was wrong.

Thanks, Marco

fgalan commented 8 years ago

Not sure of fully understand the problem. Do you mean that Orion is sending notifications before the attributes are changed?

Maybe including the subscription post you are using could help to clarify... Thanks!

marc0f commented 8 years ago

Yes, sometimes Orion is sending notifications before all the attributes are changed. This is the typical payload sent to IDAS: 'a|valueA#b|valueB#c|valueC#d|valueD#e|valueE#f|valueF#g|valueG#h|valueH#i|valueI' (where a=aatribute, b=battribute, and so on)

Here is the subscription payload: PAYLOAD = '{ \ "entities": [ \ { \ "type": "'+ENTITY_TYPE+'", \ "isPattern": "true", \ "id": ".*" \ } \ ], \ "attributes": [ \ "aattribute", \ "battribute",\ "cattribute",\ "dattribute",\ "eattribute",\ "fattribute",\ "gattribute",\ "hattribute",\ "iattribute"\ ], \ "reference": "'+SERVER_URL+'", \ "duration": "'+DURATION+'", \ "notifyConditions": [ \ { \ "type": "ONCHANGE", \ "condValues": [ \ "eattribute" \ ] \ } \ ] \ }'

Anyway, I'm running some tests, and if the attribute that trigger the notification (eattribute) is moved to the last position of the UL2.0 payload, the issue seems to occur less often. New payload: 'a|valueA#b|valueB#c|valueC#d|valueD#f|valueF#g|valueG#h|valueH#i|valueI#e|valueE'

Thanks.

fgalan commented 8 years ago

We should "isolate" the part of the issue related with Orion. In that sense:

marc0f commented 8 years ago

but in the end, everything seems to work.

Thanks.

fgalan commented 8 years ago

If the problem is solved, could you close the issue, please? Thanks!

marc0f commented 8 years ago

Sorry, I meant that between Orion and IoTA everything seems to work. Also Orion and Proton logs do not report communication problems.

The problem remains in the Orion notification messages (in XML format, as indicated in the csubs) sent to Proton (CEP).

Here is the part of a XML notification where the attributes battery, dcu, and lqi have been sent. Neither the dcu value, nor its metadata have been correctly updated in the notification. But, in the Orion DB (entities), the dcu value is correct.

<contextAttributeList>
          <contextAttribute>
            <name>battery</name>
            <type>double</type>
            <contextValue>2.8</contextValue>
            <metadata>
              <contextMetadata>
                <name>TimeInstant</name>
                <type>ISO8601</type>
                <value>2016-01-16T20:08:47.032077</value>
              </contextMetadata>
            </metadata>
          </contextAttribute>
          <contextAttribute>
            <name>dcu</name>
            <type>string</type>
            <contextValue>DCU050003</contextValue>
            <metadata>
              <contextMetadata>
                <name>TimeInstant</name>
                <type>ISO8601</type>
                <value>2016-01-16T20:08:07.983443</value>
              </contextMetadata>
            </metadata>
          </contextAttribute>
          <contextAttribute>
            <name>lqi</name>
            <type>int</type>
            <contextValue>99</contextValue>
            <metadata>
              <contextMetadata>
                <name>TimeInstant</name>
                <type>ISO8601</type>
                <value>2016-01-16T20:08:47.032304</value>
              </contextMetadata>
            </metadata>
          </contextAttribute>

Thanks,

fgalan commented 8 years ago

Just to discard possible causes, you could try the following test: stop IoTAgent and do manual updateContext on the entities (e.g. using curl) in order to check if the notification includes all the information in the update in that case.

fgalan commented 3 years ago

Should we understand that you finally solved the issue?

It is a good idea in general to provide a comment explaining how the issue was solved before closing. That may help other users.

marc0f commented 3 years ago

Sorry, I'm no longer active on the project, thus cannot provide any further details.