Skip to content

Commit

Permalink
initial cronjob component documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
macielti committed Jul 21, 2024
1 parent bba6d00 commit 30fc2d0
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions doc/components/cronjob.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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:
```clojure
(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:
```clojure
(def system
(component/system-map
:cronjob (component.cronjob/new-cronjob <<tasks>>)))
```

0 comments on commit 30fc2d0

Please sign in to comment.