fiwarefiware-orioncratedb

Why Orion-ld after 0.8.0 is not supporting the formation of service/subservice in quantumleap logs?


Any version of orion-ld after 0.8.0 is not supporting the formation of service/subservice in quantumleap logs, thereby no table-schema formed with "mt" prefix in crate-db. But tables are formed with "et" prefix followed by entity type containing quantumleap persisted data.

Below is my example quantumleap subscription

{
  "description": "Notify me of animal locations",
  "type": "Subscription",
  "entities": [{"type": "Device"}],
  "watchedAttributes": ["location", "status", "heartRate"],
  "notification": {
    "attributes": ["location", "status", "heartRate"],
    "format": "normalized",
    "endpoint": {
      "uri": "http://quantumleap:8668/v2/notify",
      "accept": "application/json",
    }
  },
   "throttling": 10,
   "@context": "http://context:3000/data-models/ngsi-context.jsonld"
} 

How to solve this problem? I am following this tutorial text


Solution

  • This is most likely a bug in QuantumLeap. Orion-LD (NGSI-LD) is a strange beast in that it is a fork of Orion classic (NGSI-v2) and I guess that for notifications, it was still forwarding the fiware-service and fiware-service-path Headers by default until 0.8.0

    According to the 1.7.1 ETSI spec, 5.2.15 Endpoint includes an array called receiverInfo which can be used to send arbitrary headers - if you set this to include a fiware-service key-value pair, then QuantumLeap will create an mt element for the tenant.

    QuantumLeap should be reading NGSILD-Tenant as an alias of fiware-service

    Something like this:

    curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/subscriptions/' \
    -H 'Content-Type: application/ld+json' \
    -H 'NGSILD-Tenant: openiot' \
    --data-raw '{
      "description": "Notify me using the openiot fiware-service",
      "type": "Subscription",
      "entities": [{"type": "FillingLevelSensor"}],
      "watchedAttributes": ["filling"],
      "notification": {
        "attributes": ["filling", "location"],
        "format": "normalized",
        "endpoint": {
          "uri": "http://quantumleap:8668/v2/notify",
          "accept": "application/json",
          "receiverInfo": [
            {
              "key": "fiware-service",
              "value": "openiot"
            }
          ]
        }
      },
       "@context": "http://context/ngsi-context.jsonld"
    }'