繁体   English   中英

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> 10temperature <10temperature == 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:添加一些方案:

  1. Room1 temperature更改为11
  2. 具有相同的输出,但是[...{"timesSent"=>1}..., ...{"timesSent"=>1}..., ...{"timesSent"=>3}...]
  3. Room1 temperature更改为10
  4. 具有相同的输出,但是[...{"timesSent"=>2}..., ...{"timesSent"=>2}..., ...{"timesSent"=>4}...]
  5. Room1 temperature更改为9
  6. 具有相同的输出,但是[...{"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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM