Overview
The QueueEvents class is used for listening to global events emitted by a queue. This class requires a dedicated Redis connection.Constructor
The name of the queue to listen to
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.The unique identifier of the job
The name of the job
The event stream ID
active
Emitted when a job enters the active state.The unique identifier of the job
The previous state of the job
completed
Emitted when a job has successfully completed.The unique identifier of the job
The return value of the job (JSON parsed)
The previous state of the job
failed
Emitted when a job has failed.The unique identifier of the job
The reason or message describing why the job failed
The previous state of the job
progress
Emitted when a job updates its progress.The unique identifier of the job
The progress data
delayed
Emitted when a job is scheduled with a delay.The unique identifier of the job
The delay duration in milliseconds
