为什么这个 Orion 订阅不能如我所愿?
Why this orion subscription don't works as I want?
我在 Orion 1.2.1 中有以下订阅:
curl --include \
--header 'Content-Type: application/json' \
--request POST \
--data-binary '{
"description": "subscription",
"subject": {
"entities": [
{
"idPattern": "event-.*",
"type": "Event"
}
],
"condition": {
"attrs": [
"IdEvent",
"mFlag"
],
"expression": {
"q": "mFlag>0"
}
}
},
"notification": {
"attrsFormat":"legacy",
"http": {
"url" : "http://localhost:5050/notify"
},
"attrs": [
"IdEvent"
]
}
}' \
'http://localhost:1026/v2/subscriptions'
当我发送这样的实体更新时:
curl --include \
--request PATCH \
--header "Content-Type: application/json" \
--data-binary '{
"mFlag":{
"value":"5",
"type":"int"
}
}' \
'http://localhost:1026/v2/entities/event-2/attrs'
Orion 没有通知,这让我很抓狂,不知道出了什么问题。有什么想法吗?
当我删除这部分订阅时:
"expression": {
"q": "mFlag>0"
}
它可以工作,但我需要它在任何属性更改和条件满足时通知。
请注意,在 NGSIv2 中 "5"
是一个字符串,而不是一个数字。因此,为了使 "q": "mFlag>0"
过滤器按预期工作,请使用以下更新:
curl --include \
--request PATCH \
--header "Content-Type: application/json" \
--data-binary '{
"mFlag":{
"value":5,
"type":"int"
}
}' \
'http://localhost:1026/v2/entities/event-2/attrs'
我在 Orion 1.2.1 中有以下订阅:
curl --include \
--header 'Content-Type: application/json' \
--request POST \
--data-binary '{
"description": "subscription",
"subject": {
"entities": [
{
"idPattern": "event-.*",
"type": "Event"
}
],
"condition": {
"attrs": [
"IdEvent",
"mFlag"
],
"expression": {
"q": "mFlag>0"
}
}
},
"notification": {
"attrsFormat":"legacy",
"http": {
"url" : "http://localhost:5050/notify"
},
"attrs": [
"IdEvent"
]
}
}' \
'http://localhost:1026/v2/subscriptions'
当我发送这样的实体更新时:
curl --include \
--request PATCH \
--header "Content-Type: application/json" \
--data-binary '{
"mFlag":{
"value":"5",
"type":"int"
}
}' \
'http://localhost:1026/v2/entities/event-2/attrs'
Orion 没有通知,这让我很抓狂,不知道出了什么问题。有什么想法吗?
当我删除这部分订阅时:
"expression": {
"q": "mFlag>0"
}
它可以工作,但我需要它在任何属性更改和条件满足时通知。
请注意,在 NGSIv2 中 "5"
是一个字符串,而不是一个数字。因此,为了使 "q": "mFlag>0"
过滤器按预期工作,请使用以下更新:
curl --include \
--request PATCH \
--header "Content-Type: application/json" \
--data-binary '{
"mFlag":{
"value":5,
"type":"int"
}
}' \
'http://localhost:1026/v2/entities/event-2/attrs'