Skip to content

Instantly share code, notes, and snippets.

@pingles
Created December 18, 2012 14:30
Show Gist options
  • Save pingles/4328456 to your computer and use it in GitHub Desktop.
Save pingles/4328456 to your computer and use it in GitHub Desktop.
(defn subscriber-seq
[ch qname]
(let [[message-seq put] (pipe)]
(letfn [(message-handler [ch msg-meta payload])
(put {:ch ch :msg-meta msg-meta :payload payload})]
(lc/subscribe ch qname message-handler :auto-ack true))
message-seq))
(defn payload-str
[x]
(String. payload "UTF-8")
(map (comp read-json payload-str :payload)
(subscriber-seq ch qname))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment