BullMQ reusing redis connections

2.7k Views Asked by At

I am trying to add logic to re-use redis connections with bullMQ using this section of the bullMQ docs.

I am using the most recent (1.80.6) BullMQ npm version.

From the docs, the expectation is to define the createClient method, which is a property of QueueOptions.

However, doing so raises an error TS2559.

Type '{ createClient: (type: string, redisOpts: any); }' has no properties in common with type 'QueueOptions'.

Was the createClient logic deprecated?if Yes, are there alternatives?

If not, any pointers to what am doing wrong?

1

There are 1 best solutions below

1
On BEST ANSWER

You can pass an IORedis instance in as the connection.

import IORedis from 'ioredis';
const connection = new IORedis('redis://someredisurl:6379');
const myQueue = new Queue('queue_name', { connection });