telefonicaid / fiware-orion

Context Broker and CEF building block for context data management, providing NGSI interfaces.
https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/orion-api.md
GNU Affero General Public License v3.0
210 stars 265 forks source link

JEXL expression in subject.condition #4555

Open fgalan opened 5 months ago

fgalan commented 5 months ago

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

fgalan commented 3 months ago

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;
    }