Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run consumer in thread throw error KafkaConsumer is not safe for multi-threaded access #350

Open
khmelevskii opened this issue Jan 6, 2023 · 0 comments

Comments

@khmelevskii
Copy link

I'm using poll-and-loop! function with infinity loop to process events

(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

How I should handle this case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant