Thanks to visit codestin.com
Credit goes to github.com

Skip to content

cl-sdk/arr

Repository files navigation

arr1

arr

Common lisp background workers, eventually a task queue and task orchestration (coordination).


Usage

NOTE: Your application must handle process termination signals to stop the application.

arr.background-worker

There are 2 function to start and stop the background worker:

Start

(arr.background-worker:start-application &key (number-of-workers 1))

Stop

(arr.background-worker:stop-application app)

arr.global-background-worker

Same as arr.background-worker, but the state is controlled internally on this package.

Start

(arr.global-background-worker:start-application &key (number-of-workers 1))

Stop

(arr.global-background-worker:stop-application)

Custom implementation

All the generics are available in other to build your worker.

Task implementation

task is a generic definition and can be executed by all workers available.

It is (supposed) a stateless function that is fire and forget.

(defgeneric task (task-name task-data &key time &allow-other-keys))

Scheduler, enqueueing, dequeueing and runner worker function

enqueue-task and dequeue-task especified by the data store implementation.

(defgeneric enqueue-task (data-source task &key app &allow-other-keys))
(defgeneric dequeue-task (data-source &key app &allow-other-keys))

task-runner is the engine of the dispatcher worker. At this moment, all tasks, immediate or schedules, are ready to dispatch.

(defgeneric task-runner (app &key &allow-other-keys))

Just like task-runner, task-scheduler is the engine of the scheduling and queueing tasks when they are ready to be dispatched.

(defgeneric task-scheduler (app &key &allow-other-keys))

schedule-task receives the "task plan":

  • How it should be scheduled
  • Task data
(defgeneric schedule-task (data-source scheduled-time task &key app &allow-other-keys))
Enqueueing tasks
(defgeneric execute-task (app task-name &optional data))
(defgeneric execute-task-at (app time task-name &optional data))

License

Unlicense

Footnotes

  1. arr is the name of the function of the haskell's Control.Arrows package, that lifts a pure function into a computation.

About

arr (arrow) - Common lisp background workers, eventually a task queue

Resources

License

Stars

Watchers

Forks

Releases

No releases published