APPNETOS is under active development This website and its documentation are being prepared for public launch. Content and features may change.
Select Theme
Loading

Worker

Queue assignment, scheduling, priority and retry policy.

Purpose & processing

Declares a worker job. The Scheduler enqueues due work; the Runner processes queued work. A job can also be queued manually.

Parameters

Parameter Type Default Behavior
key string Required Unique worker identifier used for queueing.
queue string 'default' Runner queue to receive the job.
schedule string|null null Five-field cron expression for recurring scheduling.
interval int|null null Recurring schedule interval in seconds, based on fixed Unix time slots.
priority WorkerPriority WorkerPriority::Normal Ordering priority; smaller numeric values run earlier.
timeout int 300 Maximum execution time in seconds; must be positive.
retries int 3 Additional attempts after the initial execution; must be nonnegative.
active bool true Whether the worker is available for scheduling and resolution.

Example

#[Worker(
    key: 'dns.zone.check',
    queue: 'dns',
    interval: 300,
    priority: WorkerPriority::High,
    timeout: 120,
    retries: 2,
    active: true
)]
class ZoneCheck extends \Core\Worker\Worker\Base {}

Behavior and considerations

  • Set either schedule OR interval, never both; null for both means manual enqueueing only.
  • Cron schedules are evaluated per minute; missed slots are not replayed automatically.
  • Priority values: Critical=0, High=25, Normal=50, Low=75, Background=100.
  • Priority orders waiting jobs but does not preempt running jobs.
  • Total maximum attempts = retries + 1; retries=2 means three total attempts.
  • A runner assigned to a queue processes jobs from that queue, not unrelated queues.

Source

shared/src/Core/Worker/Annotation/Worker.php

Next Steps

Previous

Cmd

Explore Cmd

Next

Infrastructure & Storage

Explore Infrastructure & Storage