Open khmelevskii opened 1 year ago
I'm using poll-and-loop! function with infinity loop to process events
poll-and-loop!
(defn ^:private poll-and-loop! [consumer processing-fn continue?] (let [poll-ms 5000] (loop [] (when @continue? (let [records (jc/poll consumer poll-ms)] (when (seq records) (processing-fn records) (.commitSync consumer)) (recur))))))
But I don't need to block main thread. When I try to run it in another thread, for example with future I have a problem with a few subscriber java.util.ConcurrentModificationException: KafkaConsumer is not safe for multi-threaded access
future
java.util.ConcurrentModificationException: KafkaConsumer is not safe for multi-threaded access
How I should handle this case?
I'm using
poll-and-loop!
function with infinity loop to process eventsBut I don't need to block main thread. When I try to run it in another thread, for example with
future
I have a problem with a few subscriberjava.util.ConcurrentModificationException: KafkaConsumer is not safe for multi-threaded access
How I should handle this case?