           (async/close! out-ch))))
     out-ch))
 
-(comment
-(defn- process [format n in-ch]
-  (let [out-ch (async/chan buffer-size)
-        active-threads (atom n)]
-    (dotimes [i n]
-      (println (str "thread-" i))
-      (async/thread
-        (loop []
-          (if-let [msgs (async/<!! in-ch)]
-            (do
-              (async/>!! out-ch (apply ais-core/decode format msgs))
-              (recur))))
-        (swap! active-threads dec)
-        (if (= @active-threads 0)
-          (async/close! out-ch))))
-    out-ch))
-)
-
-(defn- collect [in-ch]
-  (let [out-ch (async/chan)]
-    (async/thread
-      (loop [acc []]
-        (if-let [msgs (async/<!! in-ch)]
-          (recur (concat acc msgs))
-          (async/>!! out-ch acc))))
-    out-ch))
-
 (defn- collect [in-ch]
   (let [out-ch (async/chan)]
     (async/thread

          (async/>!! out-ch acc))))
    out-ch))

(defn writer [format prefix msgs]
  (let [out-ch (async/chan)
        n (count msgs)
        active-threads (atom n)]

;;; There are simplifying assumptions as the primary goal is to illustrate a basic sample implementation
;;; of the library.
;;;   
;;; Multipart messages are assumed to flow in sequential, chronological order.      


(def buffer-size 1000)
