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));
, .