My event stream generally contains an open event followed by a close event. Let's call them O
and C
, correspndingly. However, there are two particulars:
O
may be followed by one or moreO
beforeC
arrivesC
may be missing completely (see below)
It is assumed that C
should arrive not later than within time T
after some O
. Otherwise, C
is considered missing. When a C
eventually arrives, all open O
s arrived earlier than T
from this C
are considered orphans and are of no interest.
I want esper to fire each pair of O
followed by C
, where earliest O
not farther then T
from C
is selected. Any O
s in between as well as before selected O
are skipped.
For example,
O1 O2 O3 ... C
should select (O1,C)
if datediff(O1, C) < T
should select (O2,C)
if above is false and datediff(O2, C) < T
etc.
A lost my temper in approaching this problem. Looks like my mind is not compatible with esper. Your help is very appritiated.