mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
21 lines
697 B
TypeScript
21 lines
697 B
TypeScript
import { Queue as BullQueue } from 'bullmq';
|
|
import { JSONObject } from 'Common/Types/JSON';
|
|
import ObjectID from 'Common/Types/ObjectID';
|
|
import { RedisHostname, RedisPort } from '../Config';
|
|
|
|
export enum QueueName {
|
|
Workflow ="Workflow"
|
|
}
|
|
|
|
export default class Queue {
|
|
public static getQueue(queueName: QueueName): BullQueue {
|
|
return new BullQueue(queueName, { connection: {
|
|
host: RedisHostname.toString(),
|
|
port: RedisPort.toNumber()
|
|
}});
|
|
}
|
|
|
|
public static async addJob(queueName: QueueName, jobId: ObjectID, jobName: string, data: JSONObject){
|
|
await this.getQueue(queueName).add(jobName, data, {jobId: jobId.toString()});
|
|
}
|
|
} |