Hi Michael,
But the very first example fails for me for two reasons:
1. the 2nd arg to subscribe needs to be map of topics and qoses
2. disconnecting is not allowed in a callback
(defn -main
[& args]
(let [id (mh/generate-id)
(mh/subscribe conn ["hello"] (fn [^String topic _ ^bytes payload]
(println (String. payload "UTF-8"))
(mh/disconnect conn)
(System/exit 0)))
(mh/publish conn "hello" "Hello, world")))
I had to make a couple of changes:
(defn -main
[& args]
(let [id (mh/generate-id)
topics-and-qos {"hello" 0}]
(mh/subscribe conn topics-and-qos (fn [^String topic _ ^bytes payload]
(println (String. payload "UTF-8"))
(System/exit 0)))
(mh/publish conn "hello" "Hello, world")
(mh/disconnect conn)))
It seems that some of the subsequent examples may have similar issues so I've not tried them yet.
BTW using beta9 + Clojure 1.7