     rets))
 
 (defn close-batch-resources [event]
-  (let [rets (call-with-lifecycle-handler
-              event
-              :lifecycle/after-batch
-              (:onyx.core/compiled-handle-exception-fn event)
-              (:onyx.core/compiled-after-batch-fn event)
-              event)]
+  (let [rets (lc/invoke-after-batch event)]
     (taoensso.timbre/trace (format "[%s / %s] Closed batch plugin resources"
                                    (:onyx.core/id rets)
                                    (:onyx.core/lifecycle-id rets)))


                   (= ch retry-ch)
                   (->> (p-ext/retry-segment pipeline event v)
                        (call-with-lifecycle-handler
                          event
                          :lifecycle/after-retry-segment
                          (:onyx.core/compiled-handle-exception-fn event)
                          compiled-after-retry-segment-fn
                          event
                          v))

                   (= ch seal-ch)
                   (do

  event)

(defn inject-batch-resources [compiled-before-batch-fn pipeline event]
  (let [rets (-> (lc/invoke-before-batch compiled-before-batch-fn event)
                 (assoc :onyx.core/lifecycle-id (uuid/random-uuid)))]
    (taoensso.timbre/trace (format "[%s / %s] Started a new batch"
                                   (:onyx.core/id rets) (:onyx.core/lifecycle-id rets)))
