@forklaunch/implementation-worker-redis 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.
package/lib/consumers/index.js
CHANGED
|
@@ -26,6 +26,11 @@ module.exports = __toCommonJS(consumers_exports);
|
|
|
26
26
|
|
|
27
27
|
// consumers/redisWorker.consumer.ts
|
|
28
28
|
var RedisWorkerConsumer = class {
|
|
29
|
+
queueName;
|
|
30
|
+
cache;
|
|
31
|
+
options;
|
|
32
|
+
processEvents;
|
|
33
|
+
failureHandler;
|
|
29
34
|
constructor(queueName, cache, options, processEvents, failureHandler) {
|
|
30
35
|
this.queueName = queueName;
|
|
31
36
|
this.cache = cache;
|
package/lib/consumers/index.mjs
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// consumers/redisWorker.consumer.ts
|
|
2
2
|
var RedisWorkerConsumer = class {
|
|
3
|
+
queueName;
|
|
4
|
+
cache;
|
|
5
|
+
options;
|
|
6
|
+
processEvents;
|
|
7
|
+
failureHandler;
|
|
3
8
|
constructor(queueName, cache, options, processEvents, failureHandler) {
|
|
4
9
|
this.queueName = queueName;
|
|
5
10
|
this.cache = cache;
|
|
@@ -12,13 +12,25 @@ export class RedisWorkerConsumer<
|
|
|
12
12
|
Options extends RedisWorkerOptions
|
|
13
13
|
> implements WorkerConsumer<EventEntity>
|
|
14
14
|
{
|
|
15
|
+
protected readonly queueName: string;
|
|
16
|
+
protected readonly cache: TtlCache;
|
|
17
|
+
protected readonly options: Options;
|
|
18
|
+
protected readonly processEvents: WorkerProcessFunction<EventEntity>;
|
|
19
|
+
protected readonly failureHandler: WorkerFailureHandler<EventEntity>;
|
|
20
|
+
|
|
15
21
|
constructor(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
) {
|
|
22
|
+
queueName: string,
|
|
23
|
+
cache: TtlCache,
|
|
24
|
+
options: Options,
|
|
25
|
+
processEvents: WorkerProcessFunction<EventEntity>,
|
|
26
|
+
failureHandler: WorkerFailureHandler<EventEntity>
|
|
27
|
+
) {
|
|
28
|
+
this.queueName = queueName;
|
|
29
|
+
this.cache = cache;
|
|
30
|
+
this.options = options;
|
|
31
|
+
this.processEvents = processEvents;
|
|
32
|
+
this.failureHandler = failureHandler;
|
|
33
|
+
}
|
|
22
34
|
|
|
23
35
|
private async retrieveEvents(): Promise<EventEntity[]> {
|
|
24
36
|
const events = (
|
|
@@ -8,11 +8,15 @@ export class RedisWorkerProducer<
|
|
|
8
8
|
Options extends RedisWorkerOptions
|
|
9
9
|
> implements WorkerProducer<EventEntity>
|
|
10
10
|
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
) {
|
|
11
|
+
private readonly queueName: string;
|
|
12
|
+
private readonly cache: TtlCache;
|
|
13
|
+
private readonly options: Options;
|
|
14
|
+
|
|
15
|
+
constructor(queueName: string, cache: TtlCache, options: Options) {
|
|
16
|
+
this.queueName = queueName;
|
|
17
|
+
this.cache = cache;
|
|
18
|
+
this.options = options;
|
|
19
|
+
}
|
|
16
20
|
|
|
17
21
|
async enqueueJob(event: EventEntity): Promise<void> {
|
|
18
22
|
await this.cache.enqueueRecord(this.queueName, event);
|
package/lib/producers/index.js
CHANGED
|
@@ -26,6 +26,9 @@ module.exports = __toCommonJS(producers_exports);
|
|
|
26
26
|
|
|
27
27
|
// producers/redisWorker.producer.ts
|
|
28
28
|
var RedisWorkerProducer = class {
|
|
29
|
+
queueName;
|
|
30
|
+
cache;
|
|
31
|
+
options;
|
|
29
32
|
constructor(queueName, cache, options) {
|
|
30
33
|
this.queueName = queueName;
|
|
31
34
|
this.cache = cache;
|
package/lib/producers/index.mjs
CHANGED
package/package.json
CHANGED