[ANN] carmine-streams - utilities for working with Redis streams

31 views
Skip to first unread message

Oliver Hine

unread,
May 22, 2020, 4:33:44 AM5/22/20
to Clojure
Hi everyone,

I'm pleased to announce the first proper release of carmine-streams, a library for working with Redis streams in Clojure using carmine.

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.


For example, consuming a stream via a consumer group is as simple as this:

(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))

More details are in the readme. It's available now on Clojars.

Thanks and enjoy,
Oliy
Reply all
Reply to author
Forward
0 new messages