SubscribableJob

SubscribableJob

SubscribableJob

This is a type of Job object that allows you to subscribe to updates to the Job. It is returned by the JobQueue's add() method. Note that the subscription capability is only supported if the JobQueueStrategy implements the InspectableJobQueueStrategy interface (e.g. the SqlJobQueueStrategy does support this).

Signature

class SubscribableJob<T extends JobData<T> = any> extends Job<T> {
  constructor(job: Job<T>, jobQueueStrategy: JobQueueStrategy)
  updates(options?: { pollInterval?: number; timeoutMs?: number }) => Observable<JobUpdate<T>>;
}

Extends

Members

constructor

method
type:
(job: Job<T>, jobQueueStrategy: JobQueueStrategy) => SubscribableJob

updates

method
type:
(options?: { pollInterval?: number; timeoutMs?: number }) => Observable<JobUpdate<T>>

Returns an Observable stream of updates to the Job. Works by polling the current JobQueueStrategy’s findOne() method to obtain updates. If this updates are not subscribed to, then no polling occurs.

The polling interval defaults to 200ms, but can be configured by passing in an options argument. Polling will also timeout after 1 hour, but this timeout can also be configured by passing the timeoutMs option.