New: Headless Commerce with Remix! read more

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?: JobUpdateOptions) => Observable<JobUpdate<T>>;
}

Extends

Members

constructor

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

updates

method
type:
(options?: JobUpdateOptions) => 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.

Polling interval, timeout and other options may be configured with an options arguments JobUpdateOptions.