4

我正在使用 Fiware cygnus 订阅 orion 上下文代理实体。是否可以使用一个脚本订阅所有上下文更新?我不想一一做。以下是订阅示例:

(curl 192.168.1.79:1026/v1/subscribeContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Fiware-Service: test' --header 'Fiware-ServicePath: /testPath' -d @- | python -mjson.tool) <<EOF
{
    "entities": [
        {
            "type": "room",
            "isPattern": "false",
            "id": "temperature"
        }
    ],
    "attributes": [
        "tmpValue"
    ],
    "reference": "http://192.168.1.40:5050/notify",
    "duration": "P1M",
    "notifyConditions": [
        {
            "type": "ONCHANGE",
            "condValues": [
                "tmpValue"
            ]
        }
    ],
    "throttling": "PT1S"
}
EOF
4

1 回答 1

2

您可以使用以下方式订阅任何实体中的更改:

{
    "entities": [
        {
            "type": "",
            "isPattern": "true",
            "id": ".*"
        }
    ],
    "attributes": [ ],
    "reference": "http://192.168.1.40:5050/notify",
    "duration": "P1M",
    "notifyConditions": [
        {
            "type": "ONCHANGE",
            "condValues": [
                "tmpValue"
            ]
        }
    ],
    "throttling": "PT1S"
}

这样做,通知将包括实体的所有属性,并在每次tmpValue属性更改时生成。目前(Orion 0.23.0)您无法订阅任何属性的更改(您需要知道在订阅时要监控的属性列表),但它计划作为未来的功能。

编辑:从 Orion 0.27.0 开始,您可以订阅任何属性的更改。为此,请在订阅中省略该condValues字段(或使用空数组[]作为值)。

于 2015-08-05T11:51:35.337 回答