Documentation
¶
Overview ¶
Package sched holds packtrail's use of JetStream message scheduling: the validator for cron expressions (so a typo fails at registration instead of inside the engine) and the header set for durable one-shot timers and cron schedules.
Index ¶
Constants ¶
const ( HeaderSchedule = "Nats-Schedule" HeaderScheduleTarget = "Nats-Schedule-Target" HeaderScheduleTZ = "Nats-Schedule-Time-Zone" HeaderScheduler = "Nats-Scheduler" HeaderScheduleNext = "Nats-Schedule-Next" )
NATS message-scheduling headers.
Variables ¶
This section is empty.
Functions ¶
func At ¶
At returns the schedule pattern firing once at t. The server parses @at with time.RFC3339, which accepts fractional seconds, and fires a past time immediately. The fraction is kept: a time truncated to the second fires up to a second early — a 1 s attempt timeout could fire almost at once (found with G5-02).
func ValidateCron ¶
ValidateCron reports whether expr is a schedule the NATS server will accept, without publishing anything.
The grammar mirrors the server's parser (server/cron.go): the predefined `@` schedules, `@every <duration>` (at least one second), `@at <RFC3339 time>`, or six space-separated fields
second minute hour day-of-month month day-of-week
each a comma-separated list of terms, where a term is `*`, `?`, a number or a name, optionally a `-`-range, optionally followed by `/step`. Like the server, empty comma terms are skipped and anything after `*`/`?` in a range is ignored. `@every`/`@at` arguments are fully parsed, not accepted on shape alone.
Types ¶
This section is empty.