telefonicaid/fiware-orion

JEXL expression in subject.condition

fgalan opened this issue · 1 comments

Is your feature request related to a problem / use case? Please describe.

After the implementation of #4004, JEXL is supported in custom notifications. However, it would be great to support it also in the condition triggering the notification. That would expand the support to new use cases.

Describe the solution you'd like

Include a new field in subject.condition in subscription which value would be a JEXL expressions. If that expression is evaluated to true then the notification is triggered (as usual, combining the condition with AND semantics with the other conditions in subject.condition, ej. q-filter, geo-filter, etc.).

Not sure how to name the new field. expression would be a great name, but it is already taken :)

Describe alternatives you've considered

None.

Describe why you need this feature

  • To approach a new use case.
  • To improve or simplify an scenario.

Current q and mq evaluation (the jexl check should be added in a similar place)

    /* Check 2: String Filters */
    if ((tSubP->stringFilterP != NULL) && (!tSubP->stringFilterP->match(notifyCerP)))
    {
      continue;
    }

    if ((tSubP->mdStringFilterP != NULL) && (!tSubP->mdStringFilterP->match(notifyCerP)))
    {
      continue;
    }