Skip to content

Instantly share code, notes, and snippets.

@l1x

l1x/sample.clj Secret

Created February 26, 2015 23:58
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 l1x/2a2b794379752199cd4b to your computer and use it in GitHub Desktop.
Save l1x/2a2b794379752199cd4b to your computer and use it in GitHub Desktop.
(defn message-loops
""
[^ArrayList streams]
(log/info "#streams" (count streams))
(doseq [ ^KafkaStream stream streams ]
(async/thread
(let [ lazy-messagez (lazy-messages (.iterator stream)) ]
(async/go-loop [[message-and-metadata & rest-of-the-stream] lazy-messagez]
(async/>!! work-chan (message-to-vec message-and-metadata))
(recur rest-of-the-stream))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment