Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Remark: Although part of the core system, this operator is still BETA!

This operator allow to evaluate expressions (similar to Map operator). The operator needs MEP Functions that return Command Objects. In the same way as map, the operator is triggered when an input event arrives. This operator can be used to create actors.

...

Code Block
///Sensor management start logging 
cmd = COMMAND({CommandExpression='startLogging("Camera1234"))'}, in)

/// change Timer period
cmd = COMMAND({commandExpression='setPeriod("MyTimer.transport", 1000.0))'}, in)

/// add query
cmd = COMMAND({CommandExpression='addQuery("data = ACCESS(...)", "PQL")'}, in)


Here is a more complex example:are more complex example:

Code Block
#PARSER PQL
#QNAME StopAllQueries

#ADDQUERY
planmodifications = ACCESS({
          source='PlanModificationWatcher',
          wrapper='GenericPush',
          transport='planmodificationwatcher',
          datahandler='Tuple'
        }
      )
sel = SELECT({PREDICATE = 'EVENTTYPE == "QUERY_START" AND queryID > 4'}, planmodifications)

cmd = COMMAND({CommandExpression='stopQuery(queryId))'}, sel)
Code Block
#PARSER PQL
#ADDQUERY
timer = TIMER({
            id = 'timer1',
            period = 1000,
            starttime = 0 ,
            source = 'source'
          }
        )

filter = SELECT({
              predicate = 'time % 2 == 0',
              heartbeatrate = 1
            },
            timer
          )

command = COMMAND({
              COMMANDEXPRESSION = 'updateTransportOption("mqttsink.transport","TOPIC","TEST"+toString(time % 2))'
            },
            filter
          )
          
out = SENDER({ 
         transport = 'MQTT', 
         protocol = 'csv', 
         sink = 'mqttsink', 
         WRAPPER = 'GenericPush', 
         datahandler = 'tuple', 
         options = [ 
           ['topic','TEST'], 
           ['Broker','tcp://192.168.2.34:1888'], 
           ['Client_ID','OdysseusSender'] 
         ]               
       }, command           
     ) 
          


Code Block
#PARSER PQL
#ADDQUERY
timer = TIMER({id = 'timer1', PERIOD = 1000, STARTTIME = 0 , SOURCE = 'source'})

filter = SELECT({PREDICATE = 'time % 2 == 0'},timer)

command = COMMAND({COMMANDEXPRESSION = 'updateTransportOption("timer1.transport","PERIOD",toString((counter()+1)*1000))'}, filter)

...

You could also use punctuations to force a command execution:

Code Block
#PARSER PQL
#ADDQUERY
timer = TIMER({
            id = 'timer1',
            period = 1000,
            starttime = 0 ,
            source = 'source'
          }
        )

filter = SELECT({
              predicate = 'time % 2 == 0',
              heartbeatrate = 1
            },
            timer
          )

command = COMMAND({
              commandexpression = 'updateTransportOption("timer1.transport","PERIOD",toString((counter()+1)*1000))',
              SUPPRESSPUNCTUATIONREACTEDON = true,
              reactOnPunctuations = [['Heartbeat','updateTransportOption("timer1.transport","PERIOD",toString(point))']]
            },
            filter
          )
  • reactOnPunctuations: Contains a list of punctuations where and expression for which a reaction should be forced
  • SUPPRESSPUNCTUATIONREACTEDON: if set to true (default is false) the "used" punctuation will not be resend by the operator

...