My test case would be something like this:

;; I have a channel that I want to wrap in a publication
(def publisher (async/chan))
(def publication (async/pub publisher :topic))

;; then I put data into the publisher channel
(async/put! publisher {:topic :foo :payload "first message"})

;; then I create a channel to read data from that publication
(def reader (async/chan))
(async/sub publication :foo reader)
(async/go (println "value is: " (async/<! reader)))

;; nothing happens since the publication already read the value and dropped 
it

;; if I send another message, this time it will be read by the <! above
(async/put! c1 {:topic :foo :msg "second message"})
==> value is {:topic :foo :msg "second message"}

Is there a way not to lose that first item?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to