Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quartz, first pass. #21

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions modules.edn
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
:kit/metrics
{:path "metrics"
:doc "adds support for metrics using prometheus through iapetos"}
:kit/quartz
{:path "quartz"
:doc "adds support for quartz scheduling"}
:kit/sente
{:path "sente"
:doc "adds support for Sente websockets to cljs"}
Expand Down
33 changes: 33 additions & 0 deletions quartz/assets/src/quartz.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
(ns <<ns-name>>.edge.scheduling.quartz
(:require
[aero.core :as aero]
[integrant.core :as ig]
[kit.ig-utils :as ig-utils]
[troy-west.cronut :as cronut]))

(defmethod aero/reader 'cronut/trigger
[_ _ value]
(cronut/trigger-builder value))

(defmethod aero/reader 'cronut/cron
[_ _ value]
(cronut/shortcut-cron value))

(defmethod aero/reader 'cronut/interval
[_ _ value]
(cronut/shortcut-interval value))

(defmethod ig/suspend-key! :cronut/scheduler [_ _])

(defmethod ig/resume-key :cronut/scheduler
[key opts old-opts old-impl]
(ig-utils/resume-handler key opts old-opts old-impl))

;; Means of setting environment properties during runtime
;; Handy in case there's a scenario where you can't (for whatever reason) set
;; secrets in your JVM properties
(defmethod ig/init-key :scheduling.quartz/env-properties
[_ properties]
(doseq [[k v] properties]
(when (some? v)
(System/setProperty (name k) v))))
11 changes: 11 additions & 0 deletions quartz/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{:default
{:require-restart? true
:actions
{:assets
[["assets/src/quartz.clj" "src/clj/<<sanitized>>/edge/scheduling/quartz.clj"]]
:injections
[{:type :edn
:path "deps.edn"
:target [:deps]
:action :merge
:value {com.troy-west/cronut {:mvn/version "0.2.6"}}}]}}}