4

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
sabrina2020
  • 2,102
  • 3
  • 25
  • 54

1 Answers1

2

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).

fgalan
  • 11,732
  • 9
  • 46
  • 89
  • So Orion cannot talk automaticaly to cygnus? Example : IoTAgent and orion. All devices and value changes are sent to Orion from the IoTAgent automatically. Just by configuring the Context Broker ip in IoTAgent. – JajaDrinker Aug 05 '15 at 14:44
  • Orion can "talk" to Cygnus using NGSI10 notifications as long as the subscriptions that enable such notifications are configured and coherent with the entities/attributes used by the IoTAgent. In order to trigger notificaitons you can enumera the list of attributes used by the IoTAgent. – fgalan Aug 05 '15 at 16:28
  • How do I subscribe events from Orion to CEP? – urb Oct 06 '15 at 16:01
  • I think is better to ask that in a separate question, in order not "mixing" answers. Don't forget to tell to which CEP implementation you refer in that new question, please. Thanks! – fgalan Oct 06 '15 at 17:12
  • 1
    Any updates on this feature (to subscribe to all orion entities from cygnus)? is there a fixed release on which it will be implemented? Thanks! – sabrina2020 Oct 07 '15 at 10:29
  • Subscription to all entities is already supported: with id `".*"`, type `""` and isPattern `"true"`. What is pending (as in 0.24.0) is to subscribe to any attribute in the entities. You can monitor its status in github.com/telefonicaid/fiware-orion/issues/350 (and add +1 as comment if you support its implementation :) – fgalan Oct 07 '15 at 10:41
  • @fgalan, last version supports subscription of the all attributes ? – urb Nov 04 '15 at 11:28
  • Orion 0.25.0 has the same functionality than 0.24.0 regarding this – fgalan Nov 04 '15 at 11:47
  • The feature will be finally included in Orion 0.27.0 (answer post has been edited in that way). – fgalan Jan 15 '16 at 16:50