bullmq
This commit is contained in:
27
src/managers/queueManager.ts
Normal file
27
src/managers/queueManager.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import IORedis from 'ioredis';
|
||||
import { Job, Queue, Worker } from 'bullmq'
|
||||
import CharacterJoin from '../events/zone/characterJoin'
|
||||
|
||||
class QueueManager {
|
||||
private connection!: IORedis;
|
||||
public queue!: Queue;
|
||||
public worker!: Worker;
|
||||
|
||||
public boot() {
|
||||
this.connection = new IORedis('redis://@127.0.0.1:6379/4', {
|
||||
maxRetriesPerRequest: null
|
||||
});
|
||||
this.queue = new Queue('myqueue', { connection: this.connection });
|
||||
this.worker = new Worker('myqueue', async (job: Job)=>{
|
||||
console.log('hallo')
|
||||
console.log(job.data);
|
||||
console.log(job.data.data.classobj);
|
||||
const test = job.data.data.classobj();
|
||||
console.log(test);
|
||||
console.log(job.data);
|
||||
}, { connection: this.connection, concurrency: 10000 });
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export default new QueueManager();
|
Reference in New Issue
Block a user