A tiny lib with just a sliding-window reactor (if I can really name it like this) built on top of meltdown.
; Create an ordinary reactor to serve as the event input for the window.
; Suppose this reactor will handle ecommerce tickets.
(def tickets (mr/create))
; Create the actuall window
(def last-5-secs (sliding-window tickets (match-all) 5000))
; Start pumping data to the reactor
(mr/notify tickets "shirt" 20)
; And register any handler as you would do with a reactor
; Notice this handler is called on every ticker beat, not on
; every notification on tickets reactor
(on-tick last-5-secs
(fn [b]
(println "Last 5 minutes we sold: " (apply + b))))
(mr/notify tickets "water" 1.25)
(mr/notify tickets ...)
To see more details, please read this post. But in summary I wanted a very simple time based sliding mechanism to create a simple dashboard. If one already uses meltdow, it is simple to add this reactor without having to deal with bigger/complex libs or tools.
Copyright © 2014 Paulo Suzart
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.
No battle tested. Use by your own.