Skip to main content

Class Definition

Type Parameters

Properties

jobName and jobId are protected: a class job reads them as this.jobName and this.jobId, and a functional job’s ctx cannot.

Abstract Method

execute(input)

The main execution method that must be implemented.

Methods

Response Methods

respond(value)

End the run immediately with value as its result, which must match the job’s outputSchema like a returned one. Up to 1.9.1 it replaced the whole execute_job response instead.

Logging Methods

log(message)

Append a timestamped log entry to the job’s log buffer.
A functional job calls it on the ctx its handler receives: ctx.log('Starting processing'). Up to 1.9.0 log() was protected, so only a class could call it.

getLogs()

Get all log entries recorded during execution.

Progress Methods

progress(pct, total?, msg?)

Send a progress notification to the client. Returns false if no session is available.
A functional job calls it as await ctx.progress(pct, total, msg). Up to 1.9.0 progress() was protected, so only a class could call it.

Retry Tracking

attempt

The current retry attempt number (1-based).

Inherited Methods

From ExecutionContextBase:

Full Example

@Job

Job decorator

ExecutionContextBase

Base class

JobRegistry

Job registry

Jobs Guide

Jobs documentation