2016-06-28 58 views
1

我在猎户座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' 

猎户座是不是notifiying,它是让我疯了不知道什么是错的。任何想法?

当我删除了认购的这部分:

"expression": { 
    "q": "mFlag>0" 
} 

它的工作原理,但我需要在任何属性被更改,通知和条件被满足。

+1

尝试更新与'“值”:5'(即没有'“''周围5') – fgalan

+0

它的工作原理,但在我的使用场景中,cepheus将这个值发送给orion,它根本无法解决它(我总是在所有的配置中声明这个值为int)。非常感谢你的帮助。 –

+0

我提出了一个母亲问题cepheus cep开发者可以看到它,并给我们他的观点http://stackoverflow.com/questions/38100704/why-cepheus-dont-send-int-without-quotes-to-orion –

回答

1

请注意,在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' 
相关问题