The timer transport handler can be used as a periodic data source, which either sends the system time or the time passed since the query started. Can be used with the Command operator. Attribute with the output value is called "time". The timer can e.g. be used for testing purposes or to trigger some processing e.g. with DBEnrich operator.

Options

  • period: The period in milliseconds, if this is set to value below 0 there will be only one event. This can be used e.g. for an initialization query that should only be runned one time.
  • timefromstart: If set to true, start from 0 (from Jan 1th 1970). If set to false, uses the current time. (Default: false)

Commands

  • setperiod
    • Sets a new period for the timer.
    • period parameter: The new period to be set. Must be a number type (long, double...).

Example

PQL

Example
input = ACCESS({source='Source',
wrapper='GenericPush',
transport='Timer',
protocol='None',
dataHandler='Tuple',
options=[['period', '1000'], ['timefromstart', 'true'],
schema=[['time', 'Timestamp']]
})

or shorter:

input = TIMER({PERIOD = 1000, TIMEFROMSTART = true, SOURCE = 'Source'}) 

CQL

Example
CREATE STREAM source (time Timestamp)
    WRAPPER 'GenericPush'
    PROTOCOL 'None'
    TRANSPORT 'Timer'
    DATAHANDLER 'Tuple'
    OPTIONS ( 'period' '1000')


There is a short form of this operator:

timer = TIMER({PERIOD = 1000, SOURCE = 'timerSource'})
  • No labels