Orion Context Broker と Cygnus の接続

Cygnusは、Orion Context Broker のサブスクリプション通知メカニズムを利用しています。具体的には、特定のエンティティの属性が変更されるたびに通知を受ける必要があります。そのために、Cygnus はエンティティの属性変更をサブスクライブする必要があります。

curl コマンドやその他の REST クライアントを使用して、Cygnus に代わって Orion をサブスクライブすることができます。次の例では、Orion と Cygnus の両方が localhost で実行され、Cygnus が TCP/5050ポートで待機していると仮定しています :

(curl localhost:1026/v1/subscribeContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Fiware-Service: vehicles' --header 'Fiware-ServicePath: /4wheels' -d @- | python -mjson.tool) <<EOF
{
    "entities": [
        {
            "type": "car",
            "isPattern": "false",
            "id": "car1"
        }
    ],
    "attributes": [
        "speed",
        "oil_level"
    ],
    "reference": "http://localhost:5050/notify",
    "duration": "P1M",
    "notifyConditions": [
        {
            "type": "ONCHANGE",
            "condValues": [
                "speed"
            ]
        }
    ],
    "throttling": "PT1S"
}
EOF

つまり、'car' タイプで、service/tenant 'vehicles' の下に登録され、subservice '/4wheels' の 'car1'エンティティが 'speed'の値を変更するたびに、'speed' と 'oil_level'の値で http : // localhost : 5050/notify に通知を送信します。このサブスクリプションの期間は1か月です。通知を1秒に1回以上送信しないでください。