 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Application
 (defonce messages-receive-chan (atom nil))
-(defonce messages-send-chan (atom (chan)))
+(defonce messages-send-chan (atom nil))
 
 (defn start-message-loop [messages-receive-chan]
   (go-loop []

  (do
    (reset! messages-receive-chan (chan))
    (start-message-loop @messages-receive-chan)
    (start-http-server!)
    (start-router! @messages-receive-chan)))

(defn -main
  [& args]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(def memory-log (atom []))
(def message-log (atom []))
(def message-send-log (atom []))

(defn logf [s]
  (swap! memory-log conj s))

;; TODO - move calls to imp.
(defn import-file [{:keys [content]}]
  (imp/dance-perfect-xml->data (imp/read-xml-string content)))


;; TODO
;;  - test
;;  - take a map of functions to call
(defn message-dispatch [{:keys [topic payload sender]} out-chan]
  (match [topic payload]
         [:file/import xml]
