Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-16164

[fiware-stackoverflow] How to add TimeInstant, CreationDate and ModifiedDate into CrateDB with Orion Context Broker?

    Details

      Description

      Created question in FIWARE Q/A platform on 18-09-2019 at 10:09
      Please, ANSWER this question AT https://stackoverflow.com/questions/57987944/how-to-add-timeinstant-creationdate-and-modifieddate-into-cratedb-with-orion-co

      Question:
      How to add TimeInstant, CreationDate and ModifiedDate into CrateDB with Orion Context Broker?

      Description:
      I'm setting up a Firmware-Framework, where I unforutunately have to add historically Sensor Values. But I also need the creationDate and the modificationDate for other usecases.

      Therefore I add the Attribute "Metadata" with the variable "TimeInstant". Then I create an Entity, create an Orion-Subscription for that Entity and update the Entity with my old Sensor-Valses.

      The Json-File I send to the Orion-Context Broker to update the Attribute looks like this:

      {
      "metadata": {
      "TimeInstant":

      { "type": "DateTime", "value": "2015-02-02T11:35:25.0000Z" }

      },
      "type": "Number",
      "value": 0.0132361 }

      The Output in my Mongo-DB like this:

      "_id":

      { "id": "urn:ngsi-ld:SensorB-K1200____", "type": "Sensor", "servicePath": "/test/servicepath" }

      ,
      "attrNames": [
      "Sensor_value"
      ],
      "attrs": {
      "Sensor_value": {
      "value": 0.01632361,
      "type": "Number",
      "md": {
      "TimeInstant":

      { "type": "DateTime", "value": 1422876989 }

      },
      "mdNames": [
      "TimeInstant"
      ],
      "creDate": 1568712813,
      "modDate": 1568735930
      }
      },
      "creDate": 1568712813,
      "modDate": 1568735930,
      "lastCorrelator": "0a129232-d964-11e9-8e5a-0242ac130009" }

      But my Crate-DB only has the columns:
      entity_id entity_type fiware_servicepath sensor_value time_index

      My Subscription File looks like this:

      {
      "expires": "2019-12-24T18:00:00",
      "notification": {
      "http":

      { "url": "http://quantumleap:8668/v2/notify" }

      ,
      "metadata": [
      "dateCreated",
      "dateModified",
      "TimeInstant"
      ]
      },
      "subject": {
      "entities": [

      { "id": "urn:ngsi-ld:SensorB-K1200____", "type": "Sensor" }

      ]
      },
      "throttling": 0 }

      I've tried changing the "Metadata" Attributes in the Subscription-File, also tried restartig Crate-DB, ContextBroker e.g..

      I excpect the CrateDb to show all three values: "dateCreated", "dateModified" and "TimeInstant".

        Activity

          People

          • Assignee:
            smartsdk_martel MARTEL
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: