 (defn new-segment-small [batch-index]
   {:n batch-index :data hundred-bytes})
 
+;; Backported so we can test old versions of onyx
+(defn random-uuid []
+  (let [local-random (java.util.concurrent.ThreadLocalRandom/current)]
+    (java.util.UUID. (.nextLong local-random)
+                     (.nextLong local-random))))
+
 (defn new-grouping-segment [batch-index]
-  {:id (uuid/v1)
+  {:id (random-uuid)
    :event-time (java.util.Date.)
    :group-key (rand-int 10000)
    :value (rand-int 500)})

            [onyx.peer.function :as function]
            [onyx.static.default-vals :refer [defaults]]
            [onyx.types :as t]
            [clj-uuid :as uuid]
            [taoensso.timbre :refer [info warn trace fatal] :as timbre]
            [onyx.peer.pipeline-extensions :as p-ext]))


          segments (->> (flush-swap! retry 
                                     #(take max-segments %)
                                     #(subvec % (min max-segments (count %))))
                        (map (fn [m] (t/input (random-uuid) m))))
          batch (loop [n (count segments) 
                       sgs segments]
                  (if (= n max-segments)
                    sgs
                    (recur (inc n)
                           (conj sgs (t/input (random-uuid) (new-segment-fn n))))))]
      (doseq [m batch] 
        (swap! pending-messages assoc (:id m) (:message m)))
      {:onyx.core/batch batch}))
