Skip to main content
Version: Next

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

  • BasePart<"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.


executor

executor: "PgBoss"

Executor backing this job.


fn

fn: Reference<AnyFunction>

Reference to the async function that performs the job's work. It receives the submitted args and a context containing the declared entities.


kind

kind: "job"

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

Inherited from

BasePart.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.