asynchronous - Clojure RethinkDB subscribe to a changefeed -
i using clojure driver rethinkdb. want change feeds query. here have far :
(defn change-feed [conn] (loop [changes (future (-> (r/db "mydb") (r/table "mytable") r/changes (r/run conn)))] (println "date : " ((comp :name :newval) first @changes)) ;;prints nil (recur (rest changes))))
it blocks in repl when called (which normal). add data using rethinkdb interface. prints nil
, following error :
illegalargumentexception don't know how create iseq from: clojure.core$future_call$reify__6736 clojure.lang.rt.seqfrom (rt.java:528)
what doing wrong ? able :
- take items future
- know how many items can take @ once (if several waiting)
note : plan use manifold
manipulate result in end, solution using fine.
i don't think need future block there, cursor returned clj-rethinkdb library block until it's ready.
you use doseq
instead of loop might more natural.
i'm maintainer of clj-rethinkdb, , we've got changes coming down pipe present core.async interface , new cursor abstraction. if want use early, checkout https://github.com/apa512/clj-rethinkdb/pull/55
Comments
Post a Comment