 
 (def producer (.createProducer session in-queue))
 
-(doseq [n (range 10)]
+(doseq [n (range n-messages)]
   (let [message (.createMessage session true)]
     (.writeString (.getBodyBuffer message) (pr-str {:n n}))
     (.send producer message)))

     (onyx.api/shutdown conn)
     (catch Exception e (prn e)))))

(fact @results => (conj (vec (map (fn [x] {:n x}) (range 1 11))) :done))



(def results (atom []))

(doseq [n (range (inc n-messages))]
  (let [message (.receive consumer)]
    (.acknowledge message)
    (swap! results conj (read-string (.readString (.getBodyBuffer message))))))
