4
votes

I am using Fiware cygnus to subscribe to orion context broker entities. Is it possible to subscribe to all the context updates with one script? I dont want to do it one by one. Here is an example of subscription:

(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

1 Answers

2
votes

You can subscribe to changes in any entity using the following:

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

Doing so, the notification willl include all the attributes of the entity and it is generated each time the tmpValue attribute changes. Currently (Orion 0.23.0) you cannot subscribe to changes in any attribute (you need to know the list of attributes to monitor at subscription time) but it is planned as a future feature.

EDIT: since Orion 0.27.0 you can subscribe to changes in any attribute. In order to do so, do the subscription omitting the condValues field (or use an empty array [] as value).