如何让orion只在满足订阅条件时才发送通知?
How to make orion send notifications only when subscription condition is satisfied?
我已经进行了此订阅,但它总是通知属性已更改。
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'
我希望 orion 在条件中描述的任何属性发生更改并且满足条件时发出通知。
我在猎户座这个实体中的例子:
- Concert1(idEvent=Mozart,标题=Mconcert,dFlag=1)
- Concert2(idEvent=Salieri,标题=Sconcert,dFlag=0)
我希望当我对 Concert1 的任何属性进行更改时,当条件满足时,它会通知。
以Concert2为例,不满足条件,不通知。
可能吗?我在这个订阅示例中有什么问题?
文档里就不多说了:
condition: Condition that will trigger the notification. It can have
two optional properties:
attrs: array of attribute names
expression: an expression composed of q, georel, geometry and coords (see "List entities" operation above about this field).
List entities
- q: A query expression, composed of a list of statements separated by ;, i.e. q=statement;statements;statement. See Simple Query Language specification. Example: temperature>40.
猎户座版本:1.1
这可能是由于 Orion 1.1 中的订阅缓存管理存在问题。因此,该版本中的解决方案是使用 -noCache
CLI option.
禁用缓存
Orion 1.2 的错误已被识别(参见 this issue in github)并已解决。
我已经进行了此订阅,但它总是通知属性已更改。
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'
我希望 orion 在条件中描述的任何属性发生更改并且满足条件时发出通知。
我在猎户座这个实体中的例子:
- Concert1(idEvent=Mozart,标题=Mconcert,dFlag=1)
- Concert2(idEvent=Salieri,标题=Sconcert,dFlag=0)
我希望当我对 Concert1 的任何属性进行更改时,当条件满足时,它会通知。 以Concert2为例,不满足条件,不通知。
可能吗?我在这个订阅示例中有什么问题?
文档里就不多说了:
condition: Condition that will trigger the notification. It can have two optional properties:
attrs: array of attribute names
expression: an expression composed of q, georel, geometry and coords (see "List entities" operation above about this field).
List entities
- q: A query expression, composed of a list of statements separated by ;, i.e. q=statement;statements;statement. See Simple Query Language specification. Example: temperature>40.
猎户座版本:1.1
这可能是由于 Orion 1.1 中的订阅缓存管理存在问题。因此,该版本中的解决方案是使用 -noCache
CLI option.
Orion 1.2 的错误已被识别(参见 this issue in github)并已解决。