                            :onyx.core/state (atom {:timeout-pool buckets})}
 
             ex-f (fn [e] (handle-exception e restart-ch outbox-ch job-id))
-            pipeline-data (merge pipeline-data (l-ext/inject-lifecycle-resources* pipeline-data))]
+            pipeline-data (merge pipeline-data
+                                 ((:onyx.core/compiled-pre-fn pipeline-data)
+                                  (l-ext/inject-lifecycle-resources* pipeline-data)))]
 
         (while (and (first (alts!! [kill-ch task-kill-ch] :default true))
                     (not (:onyx.core/start-lifecycle? (munge-start-lifecycle pipeline-data))))

  (merge event (p-ext/write-batch event)))

(defn close-batch-resources [event]
  (merge event (l-ext/close-batch-resources* event)))

(defn launch-aux-threads!
  [messenger event outbox-ch seal-ch completion-ch task-kill-ch]

  (stop [component]
    (taoensso.timbre/info (format "[%s] Stopping Task LifeCycle for %s" id (:onyx.core/task (:pipeline-data component))))
    (when-let [event (:pipeline-data component)]
      ((:onyx.core/compiled-post-fn event) (l-ext/close-lifecycle-resources* event))

      ;; Ensure task operations are finished before closing peer connections
      (close! (:seal-ch component))
