-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial cronjob component documentation
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>>))) | ||
``` |