@forklaunch/implementation-worker-redis 0.1.1 → 0.1.2

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.
@@ -5,10 +5,10 @@ import {
5
5
  WorkerFailureHandler,
6
6
  WorkerProcessFunction
7
7
  } from '@forklaunch/interfaces-worker/types';
8
- import { RedisWorkerOptions } from '../types/redisWorker.types';
8
+ import { WorkerOptions } from '../types/redisWorker.types';
9
9
  export declare class RedisWorkerConsumer<
10
10
  EventEntity extends WorkerEventEntity,
11
- Options extends RedisWorkerOptions
11
+ Options extends WorkerOptions
12
12
  > implements WorkerConsumer<EventEntity>
13
13
  {
14
14
  protected readonly queueName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"redisWorker.consumer.d.ts","sourceRoot":"","sources":["../../consumers/redisWorker.consumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,qBAAa,mBAAmB,CAC9B,WAAW,SAAS,iBAAiB,EACrC,OAAO,SAAS,kBAAkB,CAClC,YAAW,cAAc,CAAC,WAAW,CAAC;IAGpC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM;IACpC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ;IAClC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO;IACnC,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC,WAAW,CAAC;IACpE,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAC,WAAW,CAAC;gBAJjD,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,QAAQ,E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C,IAAI,CAAC;CAQ7B"}
@@ -5,11 +5,11 @@ import {
5
5
  WorkerFailureHandler,
6
6
  WorkerProcessFunction
7
7
  } from '@forklaunch/interfaces-worker/types';
8
- import { RedisWorkerOptions } from '../types/redisWorker.types';
8
+ import { WorkerOptions } from '../types/redisWorker.types';
9
9
 
10
10
  export class RedisWorkerConsumer<
11
11
  EventEntity extends WorkerEventEntity,
12
- Options extends RedisWorkerOptions
12
+ Options extends WorkerOptions
13
13
  > implements WorkerConsumer<EventEntity>
14
14
  {
15
15
  constructor(
@@ -1,13 +1,16 @@
1
1
  import { TtlCache } from '@forklaunch/core/cache';
2
2
  import { WorkerProducer } from '@forklaunch/interfaces-worker/interfaces';
3
3
  import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
4
-
5
- export class RedisWorkerProducer<EventEntity extends WorkerEventEntity>
6
- implements WorkerProducer<EventEntity>
4
+ import { WorkerOptions } from '../types/redisWorker.types';
5
+ export class RedisWorkerProducer<
6
+ EventEntity extends WorkerEventEntity,
7
+ Options extends WorkerOptions
8
+ > implements WorkerProducer<EventEntity>
7
9
  {
8
10
  constructor(
9
11
  private readonly queueName: string,
10
- private readonly cache: TtlCache
12
+ private readonly cache: TtlCache,
13
+ private readonly options: Options
11
14
  ) {}
12
15
 
13
16
  async enqueueJob(event: EventEntity): Promise<void> {
@@ -1,4 +1,4 @@
1
- export type RedisWorkerOptions = {
1
+ export type WorkerOptions = {
2
2
  pageSize: number;
3
3
  retries: number;
4
4
  interval: number;
@@ -1,12 +1,16 @@
1
1
  import { TtlCache } from '@forklaunch/core/cache';
2
2
  import { WorkerProducer } from '@forklaunch/interfaces-worker/interfaces';
3
3
  import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
4
- export declare class RedisWorkerProducer<EventEntity extends WorkerEventEntity>
5
- implements WorkerProducer<EventEntity>
4
+ import { WorkerOptions } from '../types/redisWorker.types';
5
+ export declare class RedisWorkerProducer<
6
+ EventEntity extends WorkerEventEntity,
7
+ Options extends WorkerOptions
8
+ > implements WorkerProducer<EventEntity>
6
9
  {
7
10
  private readonly queueName;
8
11
  private readonly cache;
9
- constructor(queueName: string, cache: TtlCache);
12
+ private readonly options;
13
+ constructor(queueName: string, cache: TtlCache, options: Options);
10
14
  enqueueJob(event: EventEntity): Promise<void>;
11
15
  enqueueBatchJobs(events: EventEntity[]): Promise<void>;
12
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"redisWorker.producer.d.ts","sourceRoot":"","sources":["../../producers/redisWorker.producer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE,qBAAa,mBAAmB,CAAC,WAAW,SAAS,iBAAiB,CACpE,YAAW,cAAc,CAAC,WAAW,CAAC;IAGpC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,KAAK;gBADL,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,QAAQ;IAG5B,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAI7D"}
1
+ {"version":3,"file":"redisWorker.producer.d.ts","sourceRoot":"","sources":["../../producers/redisWorker.producer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,qBAAa,mBAAmB,CAC9B,WAAW,SAAS,iBAAiB,EACrC,OAAO,SAAS,aAAa,CAC7B,YAAW,cAAc,CAAC,WAAW,CAAC;IAGpC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAFP,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,OAAO;IAG7B,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAI7D"}
@@ -1,9 +1,11 @@
1
1
  export class RedisWorkerProducer {
2
2
  queueName;
3
3
  cache;
4
- constructor(queueName, cache) {
4
+ options;
5
+ constructor(queueName, cache, options) {
5
6
  this.queueName = queueName;
6
7
  this.cache = cache;
8
+ this.options = options;
7
9
  }
8
10
  async enqueueJob(event) {
9
11
  await this.cache.enqueueRecord(this.queueName, event);