Search code examples
esper

Defining time window in Esper CEP pattern


I have a CSV file containing time-stamped events, and I want to integrate the external time stamps in Esper pattern. I know how to use the window ext_timed. For example this works:

select * from stream.win:_ext_timed(timestamps, 5 sec).

But I don't know how to use the external times inside patterns. For example in the following query the engine internal time is used. I want to use external times with the within guard.

select * from pattern [ a=stream -> stream where timer:within(5 sec) ] 

Solution

  • The API for advancing time is in [1]. The EsperIO CSV adapter does pretty much the same thing that you are planning to do and you could look at its source code. It will use the same API [1].

    [1] http://www.espertech.com/esper/release-5.2.0/esper-reference/html_single/index.html#api-controlling-time