Skip to content

Instantly share code, notes, and snippets.

@teaforthecat
Created February 11, 2019 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teaforthecat/d250d355225133c57f1da2c3eb191616 to your computer and use it in GitHub Desktop.
Save teaforthecat/d250d355225133c57f1da2c3eb191616 to your computer and use it in GitHub Desktop.
lazy stream of kafka messages in clojure
(defn message-stream
([c]
(message-stream c ()))
([c a]
(lazy-seq
(cons a
(message-stream c (seq (poll! c)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment