This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-11
Channels
- # announcements (8)
- # beginners (17)
- # boot (1)
- # cider (20)
- # cljdoc (7)
- # cljs-dev (14)
- # clojure (62)
- # clojure-dev (16)
- # clojure-hamburg (1)
- # clojure-russia (2)
- # clojure-spec (22)
- # clojure-uk (15)
- # clojurebridge (1)
- # clojurescript (23)
- # core-async (4)
- # core-logic (17)
- # cursive (2)
- # datomic (4)
- # duct (1)
- # figwheel-main (40)
- # fulcro (15)
- # leiningen (1)
- # off-topic (27)
- # re-frame (3)
- # shadow-cljs (9)
- # specter (3)
- # sql (59)
Hi, I have the following core.async code:
(def in (chan 10))
(def inpub (pub out :msg-type))
(def out (chan 10))
(sub inpub :a out)
(sub inpub :b out)
(sub inpub :c out)
(go (>! in {:msg-type :a})
(>! in {:msg-type :b})
(>! in {:msg-type :c}))
(go-loop [i 0]
(println i (<! out))
(recur (inc i)))
Each time the go block that puts is run, messages are not always arriving in order (:a, 😛, :c) and I would like to understand at which point the ordering is being lost. The messages are put in a single go block, so second message is not put until first is taken by the channel where publication is created, and because in is buffered, I assume they enter the buffer in order.
I think the order is being lost when the publication is taking the messages from in and putting them into the subs of out, but I’d like a deeper understanding of this, and how to ensure ordering, if possible? can someone help?