Force output in Esper

I have a non real-time Esper configuration where I feed a stream that I read from a file. I am trying to create an expression that calculates statistics for the entire stream and outputs a single value at the very end. Esper has semantics in order to force the view to output every X seconds, for example, but is there semantics to ask the view or the engine to “flush” the output when you know that there are no more events to feed.

+3
source share
2 answers

It turns out that at least one way to do this is to use an output clause with a variable trigger.

The expression will look like this:

select count(*) as totalCount from events output last when OutputSummary = true

OutputSummary :

epConfiguration.addVariable("OutputSummary", Boolean.class, "false");

, true :

epRuntime.setVariableValue("OutputSummary", true);
long currentTime = epService.getEPRuntime().getCurrentTime();
epRuntime.sendEvent(new CurrentTimeEvent(currentTime));

, .

+8

60 , :

select emplyee_id from employees output snapshot every 60 sec

10000 , :

select emplyee_id from employees output snapshot every 10000 events
0

Source: https://habr.com/ru/post/1730129/


All Articles