This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-21
Channels
- # announcements (2)
- # aws (1)
- # beginners (172)
- # boot (3)
- # calva (19)
- # cider (18)
- # clj-kondo (5)
- # cljsrn (18)
- # clojure (47)
- # clojure-europe (9)
- # clojure-finland (7)
- # clojure-italy (3)
- # clojure-nl (15)
- # clojure-spec (20)
- # clojure-sweden (2)
- # clojure-uk (72)
- # clojurescript (45)
- # cursive (42)
- # datomic (6)
- # duct (4)
- # emacs (4)
- # expound (48)
- # figwheel-main (7)
- # fulcro (64)
- # graphql (8)
- # hoplon (9)
- # hyperfiddle (1)
- # jackdaw (8)
- # jobs (4)
- # jobs-discuss (61)
- # klipse (5)
- # leiningen (6)
- # off-topic (72)
- # pathom (2)
- # planck (11)
- # re-frame (1)
- # reagent (3)
- # reitit (16)
- # remote-jobs (17)
- # ring-swagger (3)
- # shadow-cljs (49)
- # spacemacs (12)
- # sql (3)
- # tools-deps (124)
- # vim (64)
- # xtdb (4)
I'm wondering (new to the library), if I wanted simply to consume messages from a kafka topic and invoke a function, passing in each message, without any further action (no sending on to other topics), which jackdaw API would suit? Sort of like a peek, but a do 🙂 Foreach?
Hey @dharrigan,
Thanks for trying it out. The jackdaw.client.log/log
function gives you a lazy seq of "datafied" consumer records. So e.g. something like this...
(with-open [consumer (-> (jackdaw.client/consumer consumer-config)
(jackdaw.client/subscribe topic-config))]
(doseq [elem (jackdaw.client.log/log consumer 1000)]
(do-it elem)))
You're welcome, thanks for providing a nice library! So, I can call (client/log 1000 my-function) and my-function would receive a message (if there are ones to consume of course)
The devil is in the details though. Once you start breaking your topic up into partitions, and having opinions about what should happen when things fail, get re-started, etc, then kafka streams has support for implementing the desired behavior.