【问题标题】:How to make orion send notifications only when subscription condition is satisfied?仅在满足订阅条件时,如何让 orion 发送通知?
【发布时间】:2016-05-24 10:25:51
【问题描述】:

我已订阅此订阅,但它始终通知属性已更改。

curl  --include \
      --header 'Content-Type: application/json' \
      --request POST \
      --data-binary '{
                       "attrsFormat":"legacy",
                       "description": "Day subscription",
                       "subject": {
                         "entities": [
                           {
                             "idPattern": "es-leon-.*",
                             "type": "Event"
                           }
                         ],
                         "condition": {
                           "attrs": [
                              "idEvent",
                              "Title",
                              "dFlag"
                           ],
                           "expression": {
                             "q": "dFlag>0"
                           }
                         }
                       },
                       "notification": {
                         "http": {
                             "url" : "http://localhost:5050/notify"
                         },
                         "attrs": [
                           "idEvent",
                           "Title",
                           "dFlag"
                         ]
                       }
                     }' \
      'http://localhost:1026/v2/subscriptions'

我希望当条件中描述的任何属性发生更改并且条件满足时通知猎户座。

例如我在猎户座中有这个实体:

  • Concert1(idEvent=Mozart,Title=Mconcert,dFlag=1)
  • Concert2(idEvent=Salieri,Title=Sconcert,dFlag=0)

我希望当我对 Concert1 的任何属性进行更改时,只要满足条件,它就会通知。 在 Concert2 的情况下,由于条件不满足,它不会通知。

有可能吗?我在这个订阅示例中有什么问题?

在文档中不多说:

condition:触发通知的条件。它可以有 两个可选属性:

  • attrs: 属性名数组

  • expression:由q、georel、geometry和coords组成的表达式(有关此字段,请参见上文“列出实体”操作)。

列出实体

  • q:查询表达式,由以;分隔的语句列表组成,即 q=statement;statements;statement。请参阅简单查询语言规范。示例:温度>40。

猎户座版本:1.1

【问题讨论】:

标签: fiware fiware-orion


【解决方案1】:

这可能是由于 Orion 1.1 中的订阅缓存管理存在问题。因此,该版本的解决方案是使用 -noCache CLI option 禁用缓存。

已发现该错误(请参阅 this issue in github)并在 Orion 1.2 中解决。

【讨论】:

  • 再次非常感谢 ;)。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-01-29
  • 2019-06-23
  • 2016-09-25
  • 2018-12-14
  • 1970-01-01
  • 2013-06-11
相关资源
最近更新 更多