首页 文章

Fiware Context Broker:我们可以订阅所有上下文更新吗?

提问于
浏览
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

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起 EDIT: 您可以订阅任何属性的更改 . 为此,请省略省略 condValues 字段的订阅(或使用空数组 [] 作为值) .

相关问题