                        job-pool)))
       (assoc context
              :broker broker
-             :mq-factory mq-factory
-             :mq-connection mq-connection
              :shared-globals globals))))
 
 (defprotocol PuppetDBServer

                      "might be due to KahaDB corruption. Consult the "
                      "PuppetDB troubleshooting guide.")
                     (throw e)))
          mq-factory (mq/activemq-connection-factory
                      (conf/mq-broker-url config))
          mq-connection (doto (.createConnection mq-factory)
                          (.setExceptionListener
                           (reify ExceptionListener
                             (onException [this ex]
                               (log/error ex "service queue connection error"))))
                          .start)
          globals {:scf-read-db read-db
                   :scf-write-db write-db
                   :catalog-hash-debug-dir catalog-hash-debug-dir
                   :command-mq {:connection mq-connection}}]
      (transfer-old-messages! mq-connection (conf/mq-endpoint config))

      (when-not disable-update-checking
        (maybe-check-for-updates config read-db))

    (.close ds))
  context)

(defn- transfer-old-messages! [mq-endpoint]
  (let [[pending exists?]
        (try+
         [(mq/queue-size "localhost" "com.puppetlabs.puppetdb.commands") true]
