'How to remove events from stream between two other events in Nesper?

I try to remove Events between two distinct events.

I've found a way to declare a dynamic context, which meets the situation in which I want to remove the events.

create objectarray schema ParentEvent(Start Bool,End Bool)
create objectarray schema ChildEvent() inherits ParentEvent

create context RemoveContext initiated by ChildEvent(Start) terminated by ChildEvent(End)

I simply cant figure out, how to construct a output stream or Window? which holds only all the other ParentEvent that are not in the context.

The way I insert the Events in my OutputStream:

insert into MyStream.out select * from ParentEvent(Start or End)


Solution 1:[1]

So lets say there are 5 events A B C D E F and you want to output all events between B and E. The EPL is:

create context BetweenCandEContext start B end E;
context BetweenCandEContext select * from Event;

So the context defines the start and end criteria.

In your case, in order to "remove events", meaning not process events, that means your end criteria is the criteria when you start "removing events" and your start criteria is when you want to stop "removing events".

I suggest, instead of thinking as "removing events" --- think of it as ignoring events, since when events arrive they ignored (and not removed).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user3613754