bullmq redis cluster

Solutions on MaxInterview for bullmq redis cluster by the best coders in the world

showing results for - "bullmq redis cluster"
Mila
22 Apr 2016
1const { Queue, Worker } = require('bullmq')
2const Redis = require('ioredis')
3
4const clusterQueue = new Queue('Superhero', {
5	prefix: '{bullMQ}',
6	connection: new Redis.Cluster([
7		{ host: '127.0.0.1', port: 6379 },
8		{ host: '127.0.0.1', port: 6380 },
9		{ host: '127.0.0.1', port: 6381 }
10	])
11})
12
13async function renderQueue() {
14	await clusterQueue.add('name:speaker', 'batman')
15}
16
17renderQueue()
18
19const WorkerQueue = new Worker('Superhero', async (job) => console.log(job.data), {
20	connection: new Redis.Cluster([
21		{ host: '127.0.0.1', port: 6379 },
22		{ host: '127.0.0.1', port: 6380 },
23		{ host: '127.0.0.1', port: 6381 }
24	]),
25	prefix: '{bullMQ}'
26})
27
28WorkerQueue.on('waiting', () => console.log('jobs waiting'))
29WorkerQueue.on('completed', () => console.log('jobs completed'))
30WorkerQueue.on('failed', () => console.log('jobs failed'))
Malia
31 Jun 2017
1const Queue = require('bull')
2const Redis = require('ioredis')
3
4const clusterQueue = new Queue('Name', {
5	prefix: '{clusterQueue}',
6	createClient: () =>
7		new Redis.Cluster([
8			{ host: '127.0.0.1', port: 6379 },
9			{ host: '127.0.0.1', port: 6380 },
10			{ host: '127.0.0.1', port: 6381 }
11		])
12})
13
14clusterQueue.process((job, done) => {
15	console.log(job.data)
16	done()
17})
18
19clusterQueue.add({ heroe: 'superman' })