QuantumLeap:将具有不同列的相同模型存储在两个表中(时间刻度)

问题描述 投票:0回答:1

我正在使用 NGSI-LDOrion Context Broker v1.4

我需要存储在两个独立的表中,这些表从同一模型开始数据,但具有不同的属性。

如果我使用两个订阅,它会将它们存储在同一个表中。

1 订阅:

{
    "description": "Store vehicle data",
    "type": "Subscription",
    "entities": [
        {
            "type": "Vehicle"
        }
    ],
    "watchedAttributes": ["alternateName", "color", "license_plate", "name"],
    "notification": {
    "attributes": ["id", "alternateName", "color", "license_plate", "name"],
        "format": "normalized",
        "endpoint": {
            "uri": "{{qunatumleap}}:8668/v2/notify",
            "accept": "application/json"
        }
    }
}

2 订阅:

{
    "description": "Store dynamic data",
    "type": "Subscription",
    "entities": [
        {
            "type": "Vehicle"
        }
    ],
    "watchedAttributes": ["location", "heading", "speed"],
    "notification": {
        "attributes": ["id","location", "heading", "speed"],
        "format": "normalized",
        "endpoint": {
            "uri": "{{quantumleap}}:8668/v2/notify",
            "accept": "application/json"
        }
    }
}
fiware fiware-orion
1个回答
0
投票

实际上,您在这里要求做的是将 Timescale 数据(通过 QuantumLeap)存储到两个单独的租户上。对于 QuantumLeap 0.8.3,这对于 NGSI-LD 是可能的,因为 QL 0.8.3 依赖于

fiware-service
标头。您可以在每个订阅中添加一个
receiverInfo
键,将数据拆分到单独的租户中,例如
tenant1
tenant2

"endpoint": {
  "uri": "http://quantumleap:8668/v2/notify",
  "accept": "application/json",
  "receiverInfo": [
    {
      "key": "fiware-service",
      "value": "tenant1"
    }
  ]
}

现在有了 QuantumLeap 1.0,我认为现在可以正确支持

NGSILD-Tenant
标头,因此这个 “技巧” 不会直接起作用,但您可以通过另一个微服务中继信息。例如:

"endpoint": {
  "uri": "http://some-new-micro-service",
  "accept": "application/json",
  "receiverInfo": [
    {
      "key": "fiware-service",
      "value": "tenant1"
    }
  ]
}

新的微服务需要做的就是改变

NGSILD-Tenant
并将其与
fiware-service
标头结合起来,以产生一个新的、独特的租户。

如果将 Orion-LDMintaka 结合使用,您可以直接使用 NGSI-LD Temporal 接口,并对两种类型的数据进行单独查询 - 例如使用 这个 Grafana 插件

© www.soinside.com 2019 - 2024. All rights reserved.