Liking cljdoc? Tell your friends :D

Cronjob Component

Should be used when you need to perform a task at a specific time or at regular intervals.

Usage

The first thing to do is define the task you want to run and add it to a tasks definition map:

(defn example-task
  [_as-of
   {:keys [_components param-test] :as _params}
   _instance]
  (log/info ::example-task "Running example task" :param-test param-test))


(def tasks {:test-task {:handler  test-task
                        :schedule "* * * * * * *"
                        :params   {}}})

After that you need to add the cronjob component to your system map:

(def system
  (component/system-map 
    :cronjob (component.cronjob/new-cronjob <<tasks>>)))

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close