Overview
The RedisConnection class manages the connection to Redis for BullMQ. It handles connection lifecycle, version checking, and script loading.You typically don’t need to use this class directly. BullMQ classes like Queue and Worker handle connections automatically.
Constructor
ConnectionOptions
required
Redis connection options (ioredis configuration or Redis instance)
Whether this connection is shared
boolean
default:"true"
Whether this connection supports blocking operations
boolean
default:"false"
Skip Redis version validation
boolean
default:"false"
Don’t wait for connection to be ready
Properties
client
status
capabilities
redisVersion
databaseType
Methods
disconnect
Disconnects from Redis.boolean
default:"true"
Whether to wait for disconnection to complete
reconnect
Reconnects to Redis.close
Closes the connection.boolean
default:"false"
Force close without waiting
Static Methods
waitUntilReady
Waits for a Redis client to be ready.Static Properties
minimumVersion
recommendedMinimumVersion
ConnectionOptions
Using ioredis Options
Using Existing Redis Instance
Redis Cluster
Events
The RedisConnection class extends EventEmitter and emits the following events:ready
Emitted when the connection is ready.error
Emitted when a connection error occurs.close
Emitted when the connection closes.Version Requirements
BullMQ requires:- Minimum version: Redis 5.0.0
- Recommended version: Redis 6.2.0 or higher
skipVersionCheck is enabled.
Important Notes
maxRetriesPerRequest
For blocking connections (Workers), BullMQ requiresmaxRetriesPerRequest: null:
