Giter VIP home page Giter VIP logo

Comments (8)

pyr avatar pyr commented on September 14, 2024

Can you share the snippet you used to commit offsets?

from kinsky.

pyr avatar pyr commented on September 14, 2024

Nevermind, I found what the issue is, working on a fix.

from kinsky.

scott-abernethy avatar scott-abernethy commented on September 14, 2024

Cool

from kinsky.

pyr avatar pyr commented on September 14, 2024

If you can, please test latest master, I'm not 100% convinced yet but it's seems to solve the issue.

from kinsky.

jmglov avatar jmglov commented on September 14, 2024

I have seen the same thing when doing a resume immediately after a commit. I'm working around it with a good ol' Thread.sleep(), but that's hacktacular at best.

from kinsky.

pyr avatar pyr commented on September 14, 2024

@jmglov can you paste the code that triggered the issue?

from kinsky.

jmglov avatar jmglov commented on September 14, 2024

Given a control channel control-ch and a sequence of topic partitions topic-partitions, this will throw a WakeupException:

(put! control-ch {:op :pause :topic-partitions topic-partitions})
(do-something-that-takes-a-few-hundred-milliseconds)
(put! control-ch {:op :commit})
(put! control-ch {:op :resume})

This does not throw the exception:

(put! control-ch {:op :pause :topic-partitions topic-partitions})
(do-something-that-takes-a-few-hundred-milliseconds)
(put! control-ch {:op :commit})
(Thread/sleep 1000)
(put! control-ch {:op :resume})

from kinsky.

pyr avatar pyr commented on September 14, 2024

Hi @jmglov,

I confirm that the following scenario now works:

  ;; Assuming a topic "test" with 4 partitions

  (def t "test")
  (def nparts 4)
  (def parts (vec (for [i (range nparts)] {:topic t :partition i})))
  (def gid (str "testgroup-" (rand-int 1000)))

  (Thread/setDefaultUncaughtExceptionHandler
   (reify Thread$UncaughtExceptionHandler
     (uncaughtException [_ thread e]
       (println (pr-str e)))))

  (require '[kinsky.client :as client] '[kinsky.async :as async] '[clojure.core.async :as a] '[clojure.pprint :refer [pprint]])

  (let [[out ctl] (async/consumer {:bootstrap.servers "localhost:9092" :group.id gid} :string :string)] (def out out) (def ctl ctl))
  (a/go (loop [] (pprint (a/<! out)) (recur)))

  (a/put! ctl {:op :subscribe :topic t})

  (do
    (println "pause")
    (a/put! ctl {:op :pause :topic-partitions parts})
    (println "commit")
    (a/put! ctl {:op :commit})
    (println "resume")
    (a/put! ctl {:op :resume :topic-partitions parts}))

from kinsky.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.