为什么这个Orion订阅无法按我的要求工作? [英] Why this orion subscription don't works as I want?
本文介绍了为什么这个Orion订阅无法按我的要求工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Orion 1.2.1中具有以下订阅:
I have the following subscription in 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'
当我发送这样的实体更新时:
When I send an entity update like this one:
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 is not notifiying and it is making me crazy don't know what is wrong. Any idea?
当我删除订阅的这一部分时:
When I remove this part of the subscription:
"expression": {
"q": "mFlag>0"
}
它可以工作,但是我需要它在任何属性更改且条件满足时发出通知.
it works but I need it to notify when any attribute is changed and the condition is satisfied.
推荐答案
请注意,在NGSIv2中,"5"
是字符串,而不是数字.因此,为了使"q": "mFlag>0"
过滤器按预期工作,请使用以下更新:
Note that in NGSIv2 "5"
is a string, not a number. Thus, in order to make the "q": "mFlag>0"
filter works as expected, use the following update:
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订阅无法按我的要求工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文