JobHost
Type Parameters
Section titled “Type Parameters”Q extends QueueDefinition<object> = QueueDefinition
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new JobHost<
Q>():JobHost<Q>
Returns
Section titled “Returns”JobHost<Q>
Methods
Section titled “Methods”classify()?
Section titled “classify()?”
optionalclassify(error):FailureKind
Classifies an error a handler threw. Return 'fatal' for errors no retry
can fix, and the job fails at once instead of spending its attempts.
Without this, only UnrecoverableError is fatal.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”handle()
Section titled “handle()”
abstracthandle(job):Promise<unknown>
Runs one attempt of one job. Return a value to store it as the job’s result.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<unknown>
onFinalFailure()?
Section titled “onFinalFailure()?”
optionalonFinalFailure(job,error):void|Promise<void>
Called once when a job fails for good (its last attempt threw, or the error was fatal). The place for a per-queue alert or a compensating write. An error thrown here is logged and does not change the job’s outcome.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”void | Promise<void>