ISO_8601 Scheduling for Clojure
Clojure
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/nolan
test/nolan
.gitignore
.travis.yml
LICENSE
README.md
project.clj

README.md

nolan

Travis Badge

For scheduling task according to limited Repeating Time Interval Syntax of ISO 8601.

#Install

Clojars Project

Usage

nolan is a customizable scheduler which can schedule according to ISO_8601 syntax of Repeating Time Interval. It can be customized to make the schedules persistent to datastore of users choice by implementing a simple protocol.

(use 'nolan.core)

nolan comes with a inbuilt in-memory scheduler which keeps all schedules in a atom and its implementation can be used as a starting point for implementing custom schedulers.

(def sc (get-mem-scheduler))

in-memory scheduler can be used to schedule functions directly.

(add-schedule sc "R4//" #(println "ok")) ; schedule 4 times starting from `now` and tail previous execution
(def scid (add-schedule sc "R//PT2S" #(println "ok"))) ; schedule indefinitely starting from `now` every 2 seconds

add-schedule returns a schedule id which can be used to expire a scehdule which stops all further executions and removes it from schedule store.

(expire sc scid)
(expired? s cscid) ;=> true

Custom Schedule Stores

MemScheduleStore in namespace nolan.store can be used as a reference for implementing custom stores by extending protocol ScheduleStore.

License

Copyright © 2014 kul

Distributed under the Eclipse Public License.