Overview
The QueueEvents class is used for listening to global events emitted by a queue. This class requires a dedicated Redis connection.Constructor
string
required
The name of the queue to listen to
QueueEventsOptions
Configuration options for queue events
Example
Methods
run
Manually starts the event consumption loop.You only need to call this if you set
autorun: false in the constructor options.close
Stops consuming events and closes the Redis connection.Events
The QueueEvents class extends EventEmitter and emits the following events:added
Emitted when a job is created and added to the queue.string
The unique identifier of the job
string
The name of the job
string
The event stream ID
active
Emitted when a job enters the active state.string
The unique identifier of the job
string
The previous state of the job
completed
Emitted when a job has successfully completed.string
The unique identifier of the job
any
The return value of the job (JSON parsed)
string
The previous state of the job
failed
Emitted when a job has failed.string
The unique identifier of the job
string
The reason or message describing why the job failed
string
The previous state of the job
progress
Emitted when a job updates its progress.string
The unique identifier of the job
number | object
The progress data
delayed
Emitted when a job is scheduled with a delay.string
The unique identifier of the job
number
The delay duration in milliseconds
