          (partition-filter-wrapper input-partitions))))
 
 
-(defn- tx-log->formatter
-  "Return a function which turns the tx-log into a a triplet of
-
-   [topic partition-key json-data]"
-  [kvstore-topic]
-  (fn [txlog]
-    (->> txlog
-         (map (fn [[k ver v]]
-                [kvstore-topic k (to-json [k ver v])])))))
-
-;; TODO: change txlog format look like events
 ;; TODO: support dispatch-fn and  format fn
 (defn topic-process-wrapper [component stream-id pipeline]
   (let [{:keys [local-store state-topic
                 output-topic-partition-fn output-topic ]
          } (stream-config component stream-id)
         output-collector (:output-collector component)
-        tx-log->messages (tx-log->formatter state-topic)
+        tx-log->messages (fn [event] [state-topic
+                                     (:sourceId event)
+                                     (to-json event)])
         out-dispatch (fn [event] [output-topic
                                  (output-topic-partition-fn event)
                                  (to-json event)])]

  (kv/restore (or kvstore (kv/make-in-memory-kvstore)) txlog-events))



(defn global-kv-restore
  "Takes a bunch of tx-log events and restores them in the global-stores"

          (build-routes cmp)) events))

  )
