Search code examples
esperepl

Esper create window based on filter


I am trying to construct a window of object from type TickVo. I managed to do so using:

TickVO.win:time_batch(1 min)

but my first tick starts for example from 44 miliseconds after midnight, meaning 00:00:00.44.

my question is: how can i make the window start from 0 miliseconds and end in such. for example: 00:00:00.44 will be added to the window of 00:00:01 but 00:00:01.15 tick will be added to the window of 00:00:02.

because what happens now is that both 00:00:00.44 and 00:00:01.15 are added to the first tick, since ( as i saw) it is relevant to the starting point.

update: after further investigation, i found out that my solution should rely on

win:ext_timed

but i still haven't figured out the filter i should use as timestamp_expression


Solution

  • The time-batch can take a reference point as a parameter in the form "TickVO#time_batch(1 min, 0L)". The zero tells the runtime to align to 0 millis.

    There are a few related approaches on the solution patterns page. You may find detailed description of how batch windows behave useful. Session windows are generally done using overlapping or non-overlapping contexts.