Optional
processor: string | URL | Processor<DataType, ResultType, NameType>Optional
opts: WorkerOptionsOptional
Connection: typeof RedisConnectionReadonly
idReadonly
nameThe name of the queue.
Readonly
optsOptions for the queue.
Readonly
qualifiedReturns a promise that resolves to a redis client. Normally used only by subclasses.
Returns the version of the Redis instance the client is connected to,
Closes the worker and related redis connections.
This method waits for current jobs to finalize before returning.
Use force boolean parameter if you do not want to wait for current jobs to be processed. When using telemetry, be mindful that it can interfere with the proper closure of spans, potentially preventing them from being exported.
Promise that resolves when the worker has been closed.
Emits an event. Normally used by subclasses to emit events.
The emitted event.
Rest
...args: Parameters<WorkerListener<DataType, ResultType, NameType>[U]>Returns a promise that resolves to the next job in queue.
worker token to be assigned to retrieved job
a Job or undefined if no job was available in the queue.
Manually starts the stalled checker. The check will run once as soon as this method is called, and then every opts.stalledInterval milliseconds until the worker is closed. Note: Normally you do not need to call this method, since the stalled checker is automatically started when the worker starts processing jobs after calling run. However if you want to process the jobs manually you need to call this method to start the stalled checker.
Wraps the code with telemetry and provides a span for configuration.
kind of the span: Producer, Consumer, Internal
operation name (such as add, process, etc)
destination name (normally the queue name)
code to wrap with telemetry
Optional
srcPropagationMetadata: stringWaits until the worker is ready to start processing jobs. In general only useful when writing tests.
Static
RateGenerated using TypeDoc
This class represents a worker that is able to process jobs from the queue. As soon as the class is instantiated and a connection to Redis is established it will start processing jobs.