diff --git a/packages/third-parties/bullmq/src/BullMQModule.spec.ts b/packages/third-parties/bullmq/src/BullMQModule.spec.ts index d98875d1b61..1dc50ee8983 100644 --- a/packages/third-parties/bullmq/src/BullMQModule.spec.ts +++ b/packages/third-parties/bullmq/src/BullMQModule.spec.ts @@ -7,7 +7,7 @@ import "./BullMQModule"; import {BullMQModule} from "./BullMQModule"; import {type BullMQConfig} from "./config/config"; import {JobMethods} from "./contracts"; -import {Job} from "./decorators"; +import {JobController} from "./decorators"; import {JobDispatcher} from "./dispatchers"; jest.mock("bullmq", () => { @@ -37,7 +37,7 @@ const bullmq = { workerQueues: ["default", "foo"] } as BullMQConfig; -@Job("cron", "default", { +@JobController("cron", "default", { repeat: { pattern: "* * * * *" } @@ -46,7 +46,7 @@ class CustomCronJob implements JobMethods { handle() {} } -@Job("regular", "default") +@JobController("regular", "default") class RegularJob { handle() {} } diff --git a/packages/third-parties/bullmq/src/decorators/Job.spec.ts b/packages/third-parties/bullmq/src/decorators/JobController.spec.ts similarity index 80% rename from packages/third-parties/bullmq/src/decorators/Job.spec.ts rename to packages/third-parties/bullmq/src/decorators/JobController.spec.ts index beeda374774..7a1c83df591 100644 --- a/packages/third-parties/bullmq/src/decorators/Job.spec.ts +++ b/packages/third-parties/bullmq/src/decorators/JobController.spec.ts @@ -1,9 +1,9 @@ -import {Job} from "./Job"; +import {JobController} from "./JobController"; import {Store} from "@tsed/core"; -describe("Job", () => { +describe("JobController", () => { it("should set the proper store data", () => { - @Job("testjob") + @JobController("testjob") class TestJob {} const store = Store.from(TestJob).get("bullmq"); @@ -14,7 +14,7 @@ describe("Job", () => { }); it("should allow settings a custom queue", () => { - @Job("testjob", "custom") + @JobController("testjob", "custom") class CustomQueueJob {} const store = Store.from(CustomQueueJob).get("bullmq"); @@ -23,7 +23,7 @@ describe("Job", () => { }); it("should allow custom options to be set", () => { - @Job("testjob", "default", { + @JobController("testjob", "default", { backoff: 69, attempts: 42 }) @@ -38,7 +38,7 @@ describe("Job", () => { }); it("should set type for cron jobs", () => { - @Job("testjob", "default", { + @JobController("testjob", "default", { repeat: {count: 42} }) class CustomCronJob {} diff --git a/packages/third-parties/bullmq/src/decorators/Job.ts b/packages/third-parties/bullmq/src/decorators/JobController.ts similarity index 78% rename from packages/third-parties/bullmq/src/decorators/Job.ts rename to packages/third-parties/bullmq/src/decorators/JobController.ts index a474eb94119..71f9819c688 100644 --- a/packages/third-parties/bullmq/src/decorators/Job.ts +++ b/packages/third-parties/bullmq/src/decorators/JobController.ts @@ -2,7 +2,7 @@ import {StoreMerge, useDecorators} from "@tsed/core"; import {Injectable} from "@tsed/di"; import {JobsOptions} from "bullmq"; -export function Job(name: string, queue: string = "default", opts: JobsOptions = {}) { +export function JobController(name: string, queue: string = "default", opts: JobsOptions = {}) { return useDecorators( StoreMerge("bullmq", { name, diff --git a/packages/third-parties/bullmq/src/decorators/index.ts b/packages/third-parties/bullmq/src/decorators/index.ts index 3d7ad07d8c6..b7e0fecd4fc 100644 --- a/packages/third-parties/bullmq/src/decorators/index.ts +++ b/packages/third-parties/bullmq/src/decorators/index.ts @@ -2,4 +2,4 @@ * @file Automatically generated by barrelsby. */ -export * from "./Job"; +export * from "./JobController"; diff --git a/packages/third-parties/bullmq/src/dispatchers/JobDispatcher.spec.ts b/packages/third-parties/bullmq/src/dispatchers/JobDispatcher.spec.ts index b86de50dc22..37c4f9189bf 100644 --- a/packages/third-parties/bullmq/src/dispatchers/JobDispatcher.spec.ts +++ b/packages/third-parties/bullmq/src/dispatchers/JobDispatcher.spec.ts @@ -1,18 +1,18 @@ import {InjectorService} from "@tsed/di"; import {JobDispatcher} from "./JobDispatcher"; import {JobMethods} from "../contracts"; -import {Job} from "../decorators"; +import {JobController} from "../decorators"; import {Queue} from "bullmq"; import {instance, mock, verify, when, objectContaining} from "ts-mockito"; -@Job("example-job", "default", { +@JobController("example-job", "default", { backoff: 69 }) class ExampleTestJob implements JobMethods { handle(payload: {msg: string}) {} } -@Job("queue-not-configured", "not-configured") +@JobController("queue-not-configured", "not-configured") class NotConfiguredQueueTestJob implements JobMethods { handle() {} } diff --git a/packages/third-parties/bullmq/src/index.ts b/packages/third-parties/bullmq/src/index.ts index 679732ab148..16e2a009dfb 100644 --- a/packages/third-parties/bullmq/src/index.ts +++ b/packages/third-parties/bullmq/src/index.ts @@ -6,6 +6,5 @@ export * from "./BullMQModule"; export * from "./config/config"; export * from "./contracts/JobMethods"; export * from "./contracts/JobStore"; -export * from "./decorators/Job"; +export * from "./decorators/JobController"; export * from "./dispatchers/JobDispatcher"; -export * from "./processors/ProcessorFactory";