OnSchedule

@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class OnSchedule(val name: String, val cron: String, val zone: String = ScheduleRule.UTC, val scope: JobScope = JobScope.SYSTEM, val misfire: Misfire = Misfire.COALESCE)

A job of a Saga run by a cron rule: the handler takes a me.ahoo.wow.api.schedule.ScheduleTick and, optionally, the SagaContext (or the SubscriptionContext it extends), and returns the commands it derives, as an @OnEvent handler of a saga does. The compiler writes the job into the Manifest. Each job is kept by the built-in aggregate <context>.schedule, whose id is the job's name in its tenant: each time the rule is due it commits Ticked(slot), and its subscription, processor.function, hands the ticks of the job's instances, and of no other job's, to the handler, retried and parked as any subscription's.

Parameters

name

the job's name, unique in its context: letters, digits, _ and -. The host configures the job under wow.schedules.<name>.*, and only there: its rule (cron, zone, misfire), whether it is enabled, and its subscription's retry and parked retries.

cron

six fields, as Spring's CronExpression reads them (0 0 3 * * *: at 03:00 every day).

zone

the time zone cron is read in, UTC by default.

scope

who the job runs for (JobScope): one instance for the service, one per tenant, or one per log partition.

misfire

what a slot missed while no node ran the job does: by default only the latest runs, and the tick counts the others as skipped.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard