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

↘锁芯ラ 提交于 2019-12-24 07:28:23

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/48498173/fiware-ngsi-v2-susbcription-getting-notified-only-about-the-attribute-that-has

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!