2
votes

I have made this subscription but it notifies always a attribute is changed.

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'

I want that orion notify when any attribute described in the condition is changed AND the condition is satisfied.

Example I have in orion this entitys:

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

I want that when I made a change to any attribute of Concert1, as the condition is satisfied, it will notify. In the case of Concert2, as the condition is not satisfied, it will not notify.

Is it posible? what I have wrong in this subscription example?

In the documentation do not said much:

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.

Version de orion: 1.1

1
Yes. Posted wrong link ) This one is right !chumakoff
It could be related with subscription cache. Could you re-try running CB with -noCache CLI option, please?fgalan
In addition, could you edit your question post to include the Orion version you are using, please? I mean, the one that contextBroker --version provides. Thanks!fgalan

1 Answers

1
votes

This could be due to a problem in subscriptions cache management in Orion 1.1. So, the solution in that version is to disable cache using -noCache CLI option.

The bug has been identified (see this issue in github) and solved for Orion 1.2.