Liking cljdoc? Tell your friends :D

verbo.sokka

Background task management library for Clojure.

Background task management library for Clojure.
raw docstring

create-task!clj

(create-task! taskq task)

Create and returns a new task.

Create and returns a new task.
sourceraw docstring

failedclj

(failed)
(failed {:keys [error-message]})
source

list-tasksclj

(list-tasks taskq
            {:keys [from to topic sub-topic] :as filters}
            {:keys [limit] :as cursor})

List all tasks for a given topic.

List all tasks for a given `topic`.
sourceraw docstring

okclj

(ok)
source

snoozedclj

(snoozed)
(snoozed {:keys [snooze-time]})
source

taskclj

(task taskq task-id)

Get task by task-id. Returns nil when no task is found.

Get task by `task-id`. Returns nil when no task is found.
sourceraw docstring

taskqcljmultimethod

source

tasksclj

(tasks taskq task-group-id)

Get tasks for a given task-group-id. Returns nil when no tasks are found for the supplied input.

Get tasks for a given `task-group-id`. Returns nil when no tasks are
found for the supplied input.
sourceraw docstring

workerclj

(worker {:keys [taskq topic pid pfn lease-time-ms keepalive-ms timeout-ms
                max-poll-interval-ms]
         :as opts})

Polls the task service on the given topic for a task and when available, obtains a lease for the task, and calls processor function pfn in a separate thread, passing the task as an argument. It also spins up a sidecar thread (keepalive) to extend the lease of the task periodically, while pfn is being executed.

processor-fn - should accept task as an argument, perform thecleanup-leased-tasks operation corresponding to the task and return a tuple containing [event-name opts]. valid event-names and args are: [:sokka/completed nil], [:sokka/failed, {:keys [error-message]}] [:sokka/snoozed, {:keys [snooze-time]}].

; keepalive-ms - keepalive timeout, will be lease-time * 0.7 ; task-timeout - how long do we expect the task to run. this can be overridden at the task level, but set at the worker level

The worker will wait until worker-timeout-ms has passed for the task to complete, if the task isn't complete by then, it closes the task, acknowledges the task with status = :failed and carries on. If the task completes successfully, it acknowledges the task with status = :ok and carries on.

The worker polls for tasks using an exponentially increasing sleeper function to prevent the worker from flooding the queue with requests during inactivity.

Polls the task service on the given `topic` for a task and when
available, obtains a lease for the task, and calls processor
function `pfn` in a separate thread, passing the task as an
argument. It also spins up a sidecar thread (keepalive) to extend
the lease of the task periodically, while pfn is being executed.

`processor-fn` - should accept task as an argument, perform thecleanup-leased-tasks
operation corresponding to the task and return a tuple containing
[event-name opts]. valid event-names and args are:
[:sokka/completed nil], [:sokka/failed, {:keys [error-message]}]
[:sokka/snoozed, {:keys [snooze-time]}].

; keepalive-ms  - keepalive timeout, will be lease-time * 0.7
; task-timeout - how long do we expect the task to run. this can be
overridden at the task level, but set at the worker level

The worker will wait until `worker-timeout-ms` has passed
for the task to complete, if the task isn't complete by then, it
closes the task, acknowledges the task with status = :failed and
carries on. If the task completes successfully, it acknowledges the
task with status = :ok and carries on.

The worker polls for tasks using an exponentially increasing
sleeper function to prevent the worker from flooding the queue with
requests during inactivity.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close