             eoq-backoff-ms exp-backoff
             auto-start     true}}]]
 
-  (let [w (Worker. conn-opts qname (atom false)
+  (let [w (Worker. conn-opts qname (atom false) (atom [])
             {:handler        handler
              :monitor        monitor
              :lock-ms        lock-ms

                        (Thread/sleep (exp-backoff (inc nerrors)))
                        (recur (inc nerrors))))))))]

        (dorun (repeatedly nthreads (fn [] (future (start-polling-loop!))))))

      true)))


  (start [this])
  (stop  [this]))

(defrecord Worker [conn-opts qname running?_ thread-futures_ opts]

  java.io.Closeable (close [this] (stop this))

  IWorker
  (stop [_]
    (when (compare-and-set! running?_ true false)
      (timbre/infof "Initiating shutdown of queue worker: %s" qname)
      (run! deref @thread-futures_)
      (timbre/infof "Message queue worker stopped: %s" qname)
      true))

