@forklaunch/implementation-worker-bullmq 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,12 +4,12 @@ import { BullMqWorkerOptions } from '../domain/types/index.mjs';
4
4
  import 'bullmq';
5
5
 
6
6
  declare class BullMqWorkerConsumer<EventEntity extends WorkerEventEntity, Options extends BullMqWorkerOptions> implements WorkerConsumer<EventEntity> {
7
+ private queue;
8
+ private worker?;
7
9
  protected readonly queueName: string;
8
10
  protected readonly options: Options;
9
11
  protected readonly processEvents: WorkerProcessFunction<EventEntity>;
10
12
  protected readonly failureHandler: WorkerFailureHandler<EventEntity>;
11
- private queue;
12
- private worker?;
13
13
  constructor(queueName: string, options: Options, processEvents: WorkerProcessFunction<EventEntity>, failureHandler: WorkerFailureHandler<EventEntity>);
14
14
  peekEvents(): Promise<EventEntity[]>;
15
15
  start(): Promise<void>;
@@ -4,12 +4,12 @@ import { BullMqWorkerOptions } from '../domain/types/index.js';
4
4
  import 'bullmq';
5
5
 
6
6
  declare class BullMqWorkerConsumer<EventEntity extends WorkerEventEntity, Options extends BullMqWorkerOptions> implements WorkerConsumer<EventEntity> {
7
+ private queue;
8
+ private worker?;
7
9
  protected readonly queueName: string;
8
10
  protected readonly options: Options;
9
11
  protected readonly processEvents: WorkerProcessFunction<EventEntity>;
10
12
  protected readonly failureHandler: WorkerFailureHandler<EventEntity>;
11
- private queue;
12
- private worker?;
13
13
  constructor(queueName: string, options: Options, processEvents: WorkerProcessFunction<EventEntity>, failureHandler: WorkerFailureHandler<EventEntity>);
14
14
  peekEvents(): Promise<EventEntity[]>;
15
15
  start(): Promise<void>;
@@ -27,6 +27,12 @@ module.exports = __toCommonJS(consumers_exports);
27
27
  // consumers/bullMqWorker.consumer.ts
28
28
  var import_bullmq = require("bullmq");
29
29
  var BullMqWorkerConsumer = class {
30
+ queue;
31
+ worker;
32
+ queueName;
33
+ options;
34
+ processEvents;
35
+ failureHandler;
30
36
  constructor(queueName, options, processEvents, failureHandler) {
31
37
  this.queueName = queueName;
32
38
  this.options = options;
@@ -36,8 +42,6 @@ var BullMqWorkerConsumer = class {
36
42
  connection: this.options.queueOptions.connection
37
43
  });
38
44
  }
39
- queue;
40
- worker;
41
45
  async peekEvents() {
42
46
  const jobs = await this.queue.getJobs(["waiting", "active"]);
43
47
  return jobs.map((job) => job.data);
@@ -1,6 +1,12 @@
1
1
  // consumers/bullMqWorker.consumer.ts
2
2
  import { Queue, Worker } from "bullmq";
3
3
  var BullMqWorkerConsumer = class {
4
+ queue;
5
+ worker;
6
+ queueName;
7
+ options;
8
+ processEvents;
9
+ failureHandler;
4
10
  constructor(queueName, options, processEvents, failureHandler) {
5
11
  this.queueName = queueName;
6
12
  this.options = options;
@@ -10,8 +16,6 @@ var BullMqWorkerConsumer = class {
10
16
  connection: this.options.queueOptions.connection
11
17
  });
12
18
  }
13
- queue;
14
- worker;
15
19
  async peekEvents() {
16
20
  const jobs = await this.queue.getJobs(["waiting", "active"]);
17
21
  return jobs.map((job) => job.data);
@@ -14,13 +14,21 @@ export class BullMqWorkerConsumer<
14
14
  {
15
15
  private queue: Queue;
16
16
  private worker?: Worker;
17
+ protected readonly queueName: string;
18
+ protected readonly options: Options;
19
+ protected readonly processEvents: WorkerProcessFunction<EventEntity>;
20
+ protected readonly failureHandler: WorkerFailureHandler<EventEntity>;
17
21
 
18
22
  constructor(
19
- protected readonly queueName: string,
20
- protected readonly options: Options,
21
- protected readonly processEvents: WorkerProcessFunction<EventEntity>,
22
- protected readonly failureHandler: WorkerFailureHandler<EventEntity>
23
+ queueName: string,
24
+ options: Options,
25
+ processEvents: WorkerProcessFunction<EventEntity>,
26
+ failureHandler: WorkerFailureHandler<EventEntity>
23
27
  ) {
28
+ this.queueName = queueName;
29
+ this.options = options;
30
+ this.processEvents = processEvents;
31
+ this.failureHandler = failureHandler;
24
32
  this.queue = new Queue(this.queueName, {
25
33
  connection: this.options.queueOptions.connection
26
34
  });
@@ -9,11 +9,12 @@ export class BullMqWorkerProducer<
9
9
  > implements WorkerProducer<EventEntity>
10
10
  {
11
11
  private queue;
12
+ private readonly queueName: string;
13
+ private readonly options: Options;
12
14
 
13
- constructor(
14
- private readonly queueName: string,
15
- private readonly options: Options
16
- ) {
15
+ constructor(queueName: string, options: Options) {
16
+ this.queueName = queueName;
17
+ this.options = options;
17
18
  this.queue = new Queue(this.queueName, {
18
19
  connection: this.options.queueOptions.connection
19
20
  });
@@ -4,9 +4,9 @@ import { BullMqWorkerOptions } from '../domain/types/index.mjs';
4
4
  import 'bullmq';
5
5
 
6
6
  declare class BullMqWorkerProducer<EventEntity extends WorkerEventEntity, Options extends BullMqWorkerOptions> implements WorkerProducer<EventEntity> {
7
+ private queue;
7
8
  private readonly queueName;
8
9
  private readonly options;
9
- private queue;
10
10
  constructor(queueName: string, options: Options);
11
11
  enqueueJob(event: EventEntity): Promise<void>;
12
12
  enqueueBatchJobs(events: EventEntity[]): Promise<void>;
@@ -4,9 +4,9 @@ import { BullMqWorkerOptions } from '../domain/types/index.js';
4
4
  import 'bullmq';
5
5
 
6
6
  declare class BullMqWorkerProducer<EventEntity extends WorkerEventEntity, Options extends BullMqWorkerOptions> implements WorkerProducer<EventEntity> {
7
+ private queue;
7
8
  private readonly queueName;
8
9
  private readonly options;
9
- private queue;
10
10
  constructor(queueName: string, options: Options);
11
11
  enqueueJob(event: EventEntity): Promise<void>;
12
12
  enqueueBatchJobs(events: EventEntity[]): Promise<void>;
@@ -27,6 +27,9 @@ module.exports = __toCommonJS(producers_exports);
27
27
  // producers/bullMqWorker.producer.ts
28
28
  var import_bullmq = require("bullmq");
29
29
  var BullMqWorkerProducer = class {
30
+ queue;
31
+ queueName;
32
+ options;
30
33
  constructor(queueName, options) {
31
34
  this.queueName = queueName;
32
35
  this.options = options;
@@ -34,7 +37,6 @@ var BullMqWorkerProducer = class {
34
37
  connection: this.options.queueOptions.connection
35
38
  });
36
39
  }
37
- queue;
38
40
  async enqueueJob(event) {
39
41
  await this.queue.add(event.id, event, {
40
42
  attempts: this.options.retries,
@@ -1,6 +1,9 @@
1
1
  // producers/bullMqWorker.producer.ts
2
2
  import { Queue } from "bullmq";
3
3
  var BullMqWorkerProducer = class {
4
+ queue;
5
+ queueName;
6
+ options;
4
7
  constructor(queueName, options) {
5
8
  this.queueName = queueName;
6
9
  this.options = options;
@@ -8,7 +11,6 @@ var BullMqWorkerProducer = class {
8
11
  connection: this.options.queueOptions.connection
9
12
  });
10
13
  }
11
- queue;
12
14
  async enqueueJob(event) {
13
15
  await this.queue.add(event.id, event, {
14
16
  attempts: this.options.retries,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/implementation-worker-bullmq",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "BullMQ implementation for forklaunch workers",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {