[英]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 , temperature <10 , temperature == 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选项禁用缓存。
该bug已被识别, 并对此产生了github问题 。 它将在较新的Orion版本中修复。
编辑:该错误已在开发部门中解决,因此可以在Orion 1.2中使用,该版本将于2016年6月上旬发布。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.