Redis does a brilliant job of being fast with loads of features and Carmine does a brilliant job of exposing all the low-level Redis commands in Clojure. Working with Redis' streams API requires quite a lot of interaction to produce desirable high-level behaviour, and that is what this library provides.
carmine-streams allows you to create streams and consumer groups, consume streams reliably, deal with failed consumers and unprocessable messages and gain visibility on the state of it all with a few simple functions.
(require '[carmine-streams.core :as cs]) (def conn-opts {}) (def stream (cs/stream-name "sensor-readings")) ;; -> stream/sensor-readings (def group (cs/group-name "persist-readings")) ;; -> group/persist-readings (def consumer (cs/consumer-name "persist-readings" 0)) ;; -> consumer/persist-readings/0
(cs/create-consumer-group! conn-opts stream group)(def opts {:block 5000}) (future (cs/start-consumer! conn-opts stream group consumer #(println "Yum yum, tasty message" %) opts))