This commit is contained in:
Zaxiure
2024-09-21 16:36:51 +02:00
parent 798bfac643
commit fd8cefd0db
6 changed files with 356 additions and 3 deletions

View 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();