尽管订阅正在运行,但如何在使用 clatedb 中的Quantumleap 时使用 Orion LD 上下文代理获取丢失的表架构?

问题描述 投票:0回答:1
{
    "cols": [
        "schema_name"
    ],
    "rows": [
        [
            "blob"
        ],
        [
            "doc"
        ],
        [
            "information_schema"
        ],
        [
            "pg_catalog"
        ],
        [
            "sys"
        ]
    ],
    "rowcount": 5,
    "duration": 7.289699
}

http://{{crate}}/_sql {“stmt”:“显示架构”} 用于读取模式。您可以看到“mtmytenant”中没有形成模式(我的服务监听器是mytenant)。

现在请看下面的内容。您可以看到订阅,但没有表架构。但是我得到了所有订阅的传感器值。

{"stmt":"显示表格"}

 
{
    "cols": [
        "table_name"
    ],
    "rows": [
        [
            "etdummydevice1"
        ],
        [
            "etdummydevice2"
        ],
        [
            "md_ets_metadata"
        ]
    ],
    "rowcount": 3,
    "duration": 24.486307
}

根据文档https://ngsi-ld-tutorials.readthedocs.io/en/latest/time-series-data.html

架构名称由 mt 前缀组成,后跟小写的 NGSILD-Tenant 标头。 IoT 代理使用 NGSILD-Tenant 标头 openiot 转发来自虚拟 IoT 设备的测量结果。这些正在 mtopeniot 模式下保存。

如果 mtopeniot 不存在,则 QuantumLeap 的订阅尚未正确设置。检查订阅是否存在,并且已配置为将数据发送到正确的位置。 这里 openiot 是标题。

带有标题的帖子 NGSILD-Tenant=mytenant,Content-Type=application/ld+json http://localhost:1026/ngsi-ld/v1/subscriptions/

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

这与 NSGI v2 完美配合,我得到了所有表模式,但对于 NGSI LD 来说有点问题。如果有人解决了这个问题。就像在教程中一样,如果我这样做了,仍然没有形成模式名称,但在教程中是这样的

ld fiware fiware-orion cratedb
1个回答
0
投票

这是因为 QuantumLeap 0.8.3 仅查找

fiware-service
标头,而不是
NGSILD-Tenant
标头。您必须故意将其提供给通知。

根据 1.7.1 ETSI 规范,5.2.15 Endpoint 包含一个名为 receiverInfo 的数组,可用于发送任意标头 - 如果您将其设置为包含

fiware-service
键值对,则 QuantumLeap 将为租户创建一个 mt 元素。

QuantumLeap should

NGSILD-Tenant
视为
fiware-service
的别名,但您可以通过添加以下内容来提供帮助:

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"
}'
© www.soinside.com 2019 - 2024. All rights reserved.