Skip to main content
Version: 0.24

Interface: Job

A background job. Can be submitted ad-hoc or run on a recurring schedule.

Create one with the job constructor.

See Recurring Jobs.

Extendsโ€‹

  • BaseSpecElement<"job">

Propertiesโ€‹

entities?โ€‹

optional entities?: string[]

Entities the worker operates on. Wasp injects a Prisma delegate for each one into the worker's context.entities.

This works like entity access in queries and actions. See Using Entities in Queries.


executorโ€‹

executor: "PgBoss"

Executor backing this job.

Currently only "PgBoss" is available.


fnโ€‹

fn: Reference<AnyFunction>

Reference to the job's NodeJS implementation. It receives the submitted args and a context containing the declared entities.

See Jobs documentation for more details.


kindโ€‹

kind: "job"

The internal Wasp type of a SpecElement. Used by the compiler. You should not set this field directly, instead use the dedicated constructors.

Inherited fromโ€‹

BaseSpecElement.kind


performExecutorOptions?โ€‹

optional performExecutorOptions?: ExecutorOptions

Executor-specific default options used when submitting the job.

These options are passed through to the executor and can be overridden when submitting the job or by Schedule.executorOptions for scheduled runs. For example, with PgBoss this can set retry limits, expiration, or priority.

Defaultโ€‹

{}

schedule?โ€‹

optional schedule?: Schedule

Cron schedule that runs the job automatically.