Aidbox
Search…
⌃K

Scheduler API

Scheduler API is a service designed to schedule asynchronous operations. Operations defines as scheduler rules with cron string and concurrency-policy.
Scheduler API operates with tasks provided by Task API so you need to include it your Aidbox service configuration before using Scheduler API.

Rule example

Properties
Required
Definition
schedule
Cron string that defines period of executing task.
concurrency-policy
Can be "forbid" or "allow". When value is "forbid" new task would not be started while previous scheduled same task is still running. When value is "allow" new task starts anyway. Default value is "forbid".
start-deadline-seconds
Period of time in seconds when task is still available to start if it misses its scheduled time. Default value is 60.
task-request
Definition of the task. Check out regular archive creating guide for more examples.
sample-every-day-rule
{:zen/tags #{awf.scheduler/rule}
:schedule "10 14 * * *"
:concurrency-policy "forbid"
:start-deadline-seconds 60
:task-request { task-definition }
}

Start using Scheduler API

To start using Scheduler API you should define scheduler-service and add it into your Aidbox service configuration:
  1. 1.
    Define your scheduler services. Include created rules in scheduler-service :rules property.
    scheduler-service
    {:zen/tags #{aidbox/service}
    :engine awf.scheduler/task-scheduler-service-engine
    :rules #{sample-every-day-rule}}
  2. 2.
    Include task, executor and scheduler services in your Aidbox service configuration if they are not already included in your configuration.
    box
    {:zen/tags #{aidbox/system}
    :services {:task-service awf.task/task-service
    :scheduler-service scheduler-service
    :aidbox-long-pool-executor-service awf.executor/aidbox-long-pool-executor-service}}
  3. 3.
    Restart Aidbox.
If all services running correctly you should see Scheduler icon on navigation bar: