Search code examples
rxjscomplex-event-processing

Using RxJS for Complex Event Processing of business events


I have a database of business events our web application produce.
I want to write JavaScript application that will take those events (several hundreds at most) and using Complex Event Processing will find some patterns in them.

For example, if we had login-failure event without login event in 15 minutes we want to know about it. We correlate between events using session ID.

I prefer to use exist library, from what I saw RxJS seem to be the right tool.
My question is how to build the stream of events using the timestamp of the original event and not the current computer time?

I saw that RxJS has operators of time but it looks like it is using the current time.

Update 1
I've found HistoricalScheduler class which looks like a good directions but there is no documentation about it and I'm not sure it is even exist in RxJS.


Solution

  • Check the rxmarbles example code.

    Especifically: https://github.com/staltz/rxmarbles/blob/master/src/controllers/utils.coffee which uses the Rx.VirtualTimeScheduler.

    From my understanding you should be able to adapt that to fit your use case