[英]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.