     (log/info "No agents connected. Broadcasting registration and waiting..")
     (put! publish-chan {:topic "broadcast" :data {:msg :agents-register}})
     (Thread/sleep 1000)))
-
-
-;-----------------------------------------------------------------------
-; Kicks off jobs/wfs when quartz says to.
-;-----------------------------------------------------------------------
-(defn- run-quartz-processing
-  "Quartz puts messages on ch. This reads those messages and triggers the jobs/wfs."
-  [ch]
-  (go-loop [{:keys[node-id]} (<! ch)]
-     (try
-       (trigger-node-execution node-id)
-       (catch Exception ex
-         (log/error ex)))
-     (recur (<! ch))))
-
-
-(defn- run-heartbeats
-  "Starts a new thread to put heartbeat messages on to ch everty t millisecs."
-  [ch t]
-  (util/start-thread "heartbeats"
-                     (fn[]
-                       (while true
-                         (put! ch {:topic "broadcast" :data {:msg :heartbeat}})
-                         (Thread/sleep t)))))
 
 
 (defn- populate-cache

  (log/info "Initializing Quartz.")
  (quartz/init quartz-chan)
  ; quartz puts stuff on the quartz-chan when a trigger is fired
  (run-quartz-processing quartz-chan)


  (log/info "Populating Quartz.")

  ; REVIEW
  ; for some reason if heartbeats are started first things work otherwise not
  ;----------------------------------------------------------------------
  (let [hb-ms (conf/heartbeats-interval-ms)
        dead-after-ms (conf/heartbeats-dead-after-ms)]
    (util/periodically "heartbeats" hb-ms #(publish msg/broadcast-topic {:msg :heartbeat}))
    (util/periodically "dead-agent-checker" dead-after-ms (partial run-dead-agent-check dead-after-ms)))

  (log/info "Populating cache.")
  (populate-cache)
