【发布时间】:2020-08-18 20:36:21
【问题描述】:
我在我的 Draco 订阅中使用 "onlyChangedAttrs" = true,但它似乎不起作用。无论是否修改,它仍在发送所有属性。此功能是否适用于特定版本的 Orion?但是我使用的是最新版本的 Orion“2.4.0-next”。你能帮我解决这个问题吗?谢谢你的帮助! 我的 draco 订阅附在此处:
curl -iX POST 'http://localhost:1026/v2/subscriptions' \
-H 'Content-Type: application/json' \
-H 'fiware-service: tk' \
-H 'fiware-servicepath: /' \
-d '{
"description": "Notify Draco of all context changes",
"subject": {
"entities": [
{
"idPattern": ".*"
}
]
},
"notification": {
"http": {
"url": "http://52.172.34.29:3003/v2/notify"
},
"onlyChangedAttrs":true,
},
"throttling": 0
}'
另外,在修改属性后发送给 Draco 的有效负载附在下面(请注意发送的所有属性,尽管我们只修改了名为“Temp”的属性):
{
"subscriptionId":"5eb290700d76dc473d3a5ace",
"data":[
{
"id":"urn:ngsi-ld:SENSOR:Wireless_Sensor-10",
"type":"SENSOR",
"A02":{
"type":"Number",
"value":20,
"metadata":{
}
},
"Description":{
"type":"Text",
"value":"",
"metadata":{
}
},
"Temp":{
"type":"Number",
"value":30,
"metadata":{
}
},
"hasParent":{
"type":"Text",
"value":"urn:ngsi-ld:HVAC:HVAC1",
"metadata":{
}
},
"isPartofContextTree":{
"type":"Text",
"value":"",
"metadata":{
}
},
"name":{
"type":"Text",
"value":"Wireless_Sensor-10",
"metadata":{
}
}
}
]
}
Orion 的版本详情:GET /version
{
"orion" : {
"version" : "2.4.0-next",
"uptime" : "0 d, 0 h, 1 m, 7 s",
"git_hash" : "4f26834ca928e468b091729d93dabd22108a2690",
"compile_time" : "Tue Mar 31 16:21:23 UTC 2020",
"compiled_by" : "root",
"compiled_in" : "3369cff2fa4c",
"release_date" : "Tue Mar 31 16:21:23 UTC 2020",
"doc" : "https://fiware-orion.rtfd.io/"
}
}
/v2/subscriptions 的输出:
[
{
"id":"5eb3e7fa331ff6cb547598e1",
"description":"Notify Draco of all context changes",
"status":"active",
"subject":{
"entities":[
{
"idPattern":".*"
}
],
"condition":{
"attrs":[
]
}
},
"notification":{
"attrs":[
],
"attrsFormat":"normalized",
"http":{
"url":"http://52.172.34.29:3003/v2/notify"
},
"onlyChangedAttrs":true
}
}
]
以下是来自 mongodb -> orion schema -> csubs 集合的 JSON:
{
"_id":"ObjectId(" "5eb3e7fa331ff6cb547598e1" ")",
"expiration":"NumberLong(" "9223372036854775807" ")",
"reference":"http://52.172.34.29:3003/v2/notify",
"custom":false,
"throttling":NumberLong(0),
"servicePath":"/",
"description":"Notify Draco of all context changes",
"status":"active",
"entities":[
{
"id":".*",
"isPattern":"true"
}
],
"attrs":[
],
"metadata":[
],
"blacklist":false,
"onlyChanged":true,
"conditions":[
],
"expression":{
"q":"",
"mq":"",
"geometry":"",
"coords":"",
"georel":""
},
"format":"normalized"
}
【问题讨论】:
-
提示:最好以文本形式提供 curl 而不是使用快照(这样可以很容易地为其他人调试,例如,将问题帖子中的粘贴复制到调试中环境)。
-
为了澄清您的设置,最好知道:1)
GET /v2/subscriptions的该服务和服务路径的输出,2)您收到的通知的有效负载(您可以暂时停止Draco 并在同一端口上运行nc或类似工具以获取通知)。请编辑您的问题帖子以包含该信息。谢谢! -
您已将 Draco 收到的通知包含在问题帖子中。伟大的!但是,仍然缺少以下信息:“该服务和服务路径的 GET /v2/subscriptions 的输出”。请也包括在内。谢谢!
-
此外,为了完全准确(因为 2.4.0-next 是动态图片 :),您能否在 CB API 中也提供
GET /version的响应,好吗?谢谢! -
@fgalan - 我已按照您的要求添加了所有详细信息、猎户座版本和订阅详细信息。你能帮忙吗?谢谢!