简体   繁体   中英

Fiware: NGSI v2 susbcription: getting notified only about the attribute that has changed

I have this subscription:

{
    "id": "5a27abba56256c402cec5654",
    "description": "my subscription",
    "status": "active",
    "subject": {
        "entities": [
            {
                "idPattern": ".*"
            }
        ],
        "condition": {
            "attrs": []
        }
    },
    "notification": {
        "timesSent": 56939,
        "lastNotification": "2018-01-29T09:06:45.00Z",
        "attrs": [],
        "attrsFormat": "normalized",
        "http": {
            "url": "http://notif_url"
        },
        "lastFailure": "2018-01-24T15:10:08.00Z",
        "lastSuccess": "2018-01-29T09:06:45.00Z"
    }
}

Using it I can get notified about new entities whithout specifiying a particular entity ID. The problem is that when one entity attribute changes I get notified about all attributes. Is it possible to get notified only about the attribute that has changed and keeping in the same time the possibility to discover new entities?

Something like in if attribut x changed in the condition part, get notified about it:

 "condition": {
                "attrs": [attribute_X]
            }
 "notification": {
            "attrs": [attribute_X]
}

Thanks!

It works the way you mention. I mean, using:

"condition": {
  "attrs": [ "attribute_X" ]
}
...
"notification": {
   "attrs": [ "attribute_X" ]
}

Whenever attribute named attribute_X changes (or appears first time, typically at entity creation time) you will receive a notification including only attribute_X

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM