pingles/clj-kafka — pull request #25 by prepor (2014-03-19 11:57:09+00:00)
Title: Do not use iterator-seq with KafkaStream

Hello!

I found issue. Last message never consumes before consumer shutdown.

This is because IteratorSeq expects that hasNext is cheap and nonblocking op and calls it BEFORE create seq (https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IteratorSeq.java#L27). So, every call of rest (like in map) blocks thread.

Fortunately we do not need immutable representation of iterator (like iterator-seq), so it's easy to work with iterators without iterator-seq.