Hi,
I try to figure out if it is possible to detect that, within a given amount of time, a certain event was not added to a stream. Say, if I recieve someEvent I want to produce a new event if within 5 seconds no other someEvent is generated. I am looking for a projection like the following:
function NoOtherSomeEventWithin5Seconds(lastEvent) {
emit(“someEventTimeouts”, “someEventTimeout”, { “lastEvent”: lastEvent });
}
fromStream(“MyStream”)
.when({
“someEvent” : function(s, e) {
setTimeout(function() { NoOtherSomeEventWithin5Seconds(e); }, 5000);
}
});
Is there any way of getting someting like the setTimeout Methode? I found an older Thread “First pass on a persistent alarm clock”. I dont understand it completely, but it might point to a solution. Can anyone give advice on this?