Fiware Orion 上下文代理订阅条件不起作用
Fiware Orion context broker subscriptions condition does not work
我正在使用 Orion Context Broker 版本 1.1.0
我的数据库中只有一个实体:
{
"id"=>"Room1",
"type"=>"Room",
"temperature"=>{"type"=>"none", "value"=>10, "metadata"=>{}}
}
我没有subscription
。
然后我创建了 3 subscriptions
:
[
{
"subject"=>{"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"], "expression"=>{"q"=>"temperature>10"}}}
},
{
"subject"=>{"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"], "expression"=>{"q"=>"temperature<10"}}}
},
{
"subject"=>{"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"], "expression"=>{"q"=>"temperature==10"}}}
}
]
如您所见,区别仅在于表达式:temperature>10, 温度<10,温度==10。
所以每次我更改 Room1 温度 我应该只有一个 subscription
触发通知。
但是它没有正常工作!!!
每次我更改 温度,我都会收到所有 3 个通知。
但是,当 subscriptions
创建时,只有其中一个触发了通知,具体取决于 Room1 的 temperature
值。它按预期工作。
但是当Room1 temperature
改变时,它不能正常工作并触发所有3个通知。
编辑:
GET /v2/subscriptions 操作的完整输出:
[
{
"id"=>"574716a22fe8cdc00a696a94",
"expires"=>"2017-04-05T14:00:00.00Z",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"],
"expression"=>{"q"=>"temperature>10"}}
},
"notification"=>{"attrs"=>["temperature"], "http"=>{"url"=>"http://localhost:1028/accumulate"}},
"throttling"=>5
},
{
"id"=>"574716a22fe8cdc00a696a95",
"expires"=>"2017-04-05T14:00:00.00Z",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"],
"expression"=>{"q"=>"temperature<10"}}
},
"notification"=>{"attrs"=>["temperature"], "http"=>{"url"=>"http://localhost:1028/accumulate"}},
"throttling"=>5},
{
"id"=>"574716a22fe8cdc00a696a96",
"expires"=>"2017-04-05T14:00:00.00Z",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"],
"expression"=>{"q"=>"temperature==10"}}
},
"notification"=>{"timesSent"=>2, "lastNotification"=>"2016-05-26T15:30:42.00Z", "attrs"=>["temperature"], "http"=>{"url"=>"http://localhost:1028/accumulate"}},
"throttling"=>5
}
]
Edit2: 添加一些场景:
- 已将
Room1 temperature
更改为 11
- 具有相同的输出,但是
[...{"timesSent"=>1}..., ...{"timesSent"=>1}..., ...{"timesSent"=>3}...]
- 已将
Room1 temperature
更改为 10
- 具有相同的输出,但是
[...{"timesSent"=>2}..., ...{"timesSent"=>2}..., ...{"timesSent"=>4}...]
- 已将
Room1 temperature
更改为 9
- 具有相同的输出,但是
[...{"timesSent"=>3}..., ...{"timesSent"=>3}..., ...{"timesSent"=>5}...]
这是由于 Orion 1.1 中的订阅缓存管理存在问题。因此,该版本中的解决方案是使用 -noCache
CLI option.
禁用缓存
错误已被识别并且 a github issue has been created about it。它将在较新的 Orion 版本中修复。
编辑: 该错误已在开发分支中解决,因此它将在 Orion 1.2 中准备就绪,将于 2016 年 6 月上旬发布。
我正在使用 Orion Context Broker 版本 1.1.0
我的数据库中只有一个实体:
{
"id"=>"Room1",
"type"=>"Room",
"temperature"=>{"type"=>"none", "value"=>10, "metadata"=>{}}
}
我没有subscription
。
然后我创建了 3 subscriptions
:
[
{
"subject"=>{"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"], "expression"=>{"q"=>"temperature>10"}}}
},
{
"subject"=>{"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"], "expression"=>{"q"=>"temperature<10"}}}
},
{
"subject"=>{"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"], "expression"=>{"q"=>"temperature==10"}}}
}
]
如您所见,区别仅在于表达式:temperature>10, 温度<10,温度==10。
所以每次我更改 Room1 温度 我应该只有一个 subscription
触发通知。
但是它没有正常工作!!!
每次我更改 温度,我都会收到所有 3 个通知。
但是,当 subscriptions
创建时,只有其中一个触发了通知,具体取决于 Room1 的 temperature
值。它按预期工作。
但是当Room1 temperature
改变时,它不能正常工作并触发所有3个通知。
编辑: GET /v2/subscriptions 操作的完整输出:
[
{
"id"=>"574716a22fe8cdc00a696a94",
"expires"=>"2017-04-05T14:00:00.00Z",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"],
"expression"=>{"q"=>"temperature>10"}}
},
"notification"=>{"attrs"=>["temperature"], "http"=>{"url"=>"http://localhost:1028/accumulate"}},
"throttling"=>5
},
{
"id"=>"574716a22fe8cdc00a696a95",
"expires"=>"2017-04-05T14:00:00.00Z",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"],
"expression"=>{"q"=>"temperature<10"}}
},
"notification"=>{"attrs"=>["temperature"], "http"=>{"url"=>"http://localhost:1028/accumulate"}},
"throttling"=>5},
{
"id"=>"574716a22fe8cdc00a696a96",
"expires"=>"2017-04-05T14:00:00.00Z",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"],
"expression"=>{"q"=>"temperature==10"}}
},
"notification"=>{"timesSent"=>2, "lastNotification"=>"2016-05-26T15:30:42.00Z", "attrs"=>["temperature"], "http"=>{"url"=>"http://localhost:1028/accumulate"}},
"throttling"=>5
}
]
Edit2: 添加一些场景:
- 已将
Room1 temperature
更改为 11 - 具有相同的输出,但是
[...{"timesSent"=>1}..., ...{"timesSent"=>1}..., ...{"timesSent"=>3}...]
- 已将
Room1 temperature
更改为 10 - 具有相同的输出,但是
[...{"timesSent"=>2}..., ...{"timesSent"=>2}..., ...{"timesSent"=>4}...]
- 已将
Room1 temperature
更改为 9 - 具有相同的输出,但是
[...{"timesSent"=>3}..., ...{"timesSent"=>3}..., ...{"timesSent"=>5}...]
这是由于 Orion 1.1 中的订阅缓存管理存在问题。因此,该版本中的解决方案是使用 -noCache
CLI option.
错误已被识别并且 a github issue has been created about it。它将在较新的 Orion 版本中修复。
编辑: 该错误已在开发分支中解决,因此它将在 Orion 1.2 中准备就绪,将于 2016 年 6 月上旬发布。