@nathapp/nestjs-queue 2.1.0-rc.1 → 2.1.0
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/TODO.md +15 -0
- package/dist/decorator/batch-process.decorator.d.ts +11 -0
- package/dist/decorator/batch-process.decorator.js +13 -0
- package/dist/decorator/batch-process.decorator.js.map +1 -0
- package/dist/decorator/index.d.ts +1 -0
- package/dist/decorator/index.js +1 -0
- package/dist/decorator/index.js.map +1 -1
- package/dist/enum/provider.enum.d.ts +0 -1
- package/dist/enum/provider.enum.js +0 -1
- package/dist/enum/provider.enum.js.map +1 -1
- package/dist/explorer/processor.explorer.d.ts +3 -0
- package/dist/explorer/processor.explorer.js +43 -1
- package/dist/explorer/processor.explorer.js.map +1 -1
- package/dist/interface/batch.interface.d.ts +23 -0
- package/dist/interface/batch.interface.js +3 -0
- package/dist/interface/batch.interface.js.map +1 -0
- package/dist/interface/index.d.ts +1 -0
- package/dist/interface/index.js +1 -0
- package/dist/interface/index.js.map +1 -1
- package/dist/interface/queue-options.interface.d.ts +1 -9
- package/dist/interface/queue-provider.interface.d.ts +13 -0
- package/dist/interface/queue-provider.interface.js.map +1 -1
- package/dist/module/queue.provider.js +0 -3
- package/dist/module/queue.provider.js.map +1 -1
- package/dist/provider/bullmq/bullmq.provider.d.ts +9 -0
- package/dist/provider/bullmq/bullmq.provider.js +104 -0
- package/dist/provider/bullmq/bullmq.provider.js.map +1 -1
- package/dist/provider/index.d.ts +0 -1
- package/dist/provider/index.js +0 -1
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/kafka/kafka.provider.d.ts +7 -0
- package/dist/provider/kafka/kafka.provider.js +150 -0
- package/dist/provider/kafka/kafka.provider.js.map +1 -1
- package/dist/provider/rabbitmq/rabbitmq.provider.d.ts +9 -0
- package/dist/provider/rabbitmq/rabbitmq.provider.js +171 -0
- package/dist/provider/rabbitmq/rabbitmq.provider.js.map +1 -1
- package/dist/utils/delayed-scheduler.js +2 -1
- package/dist/utils/delayed-scheduler.js.map +1 -1
- package/docs/BATCH_PROCESSING_PLAN.md +581 -0
- package/docs/COVERAGE_IMPLEMENTATION_TASKS.md +664 -0
- package/docs/COVERAGE_RECOVERY_PLAN.md +254 -0
- package/package.json +3 -2
- package/dist/provider/redis-pubsub/index.d.ts +0 -1
- package/dist/provider/redis-pubsub/index.js +0 -18
- package/dist/provider/redis-pubsub/index.js.map +0 -1
- package/dist/provider/redis-pubsub/redis-pubsub.provider.d.ts +0 -40
- package/dist/provider/redis-pubsub/redis-pubsub.provider.js +0 -226
- package/dist/provider/redis-pubsub/redis-pubsub.provider.js.map +0 -1
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# Coverage Recovery Plan: Batch Processing Tests
|
|
2
|
+
|
|
3
|
+
**Created**: 2026-02-09
|
|
4
|
+
**Author**: Subrina
|
|
5
|
+
**Status**: Awaiting Approval
|
|
6
|
+
**Current Branch Coverage**: 72.14%
|
|
7
|
+
**Target Branch Coverage**: 80%+
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Problem Analysis
|
|
12
|
+
|
|
13
|
+
The Batch Processing implementation added significant new code paths that are not yet covered by unit tests. The branch coverage dropped from 81% to 72.14%.
|
|
14
|
+
|
|
15
|
+
### Coverage Gap Summary
|
|
16
|
+
|
|
17
|
+
| File | Stmts | Branch | Gap Analysis |
|
|
18
|
+
|------|-------|--------|--------------|
|
|
19
|
+
| `lock-renewal.ts` | 5.71% | 0% | **Critical**: Almost entirely untested |
|
|
20
|
+
| `bullmq.provider.ts` | 68.48% | 62.5% | Batch processing methods (345-484) untested |
|
|
21
|
+
| `processor.explorer.ts` | 87.32% | 66.66% | Batch discovery logic (203-232) untested |
|
|
22
|
+
| `queue.provider.ts` | 76.92% | 58.33% | Provider factory branches (28-43) untested |
|
|
23
|
+
| `batch-process.decorator.ts` | 75% | 0% | Decorator logic untested |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Phase 1: Lock Renewal Tests (High Priority)
|
|
28
|
+
|
|
29
|
+
**File**: `test/utils/lock-renewal.spec.ts`
|
|
30
|
+
|
|
31
|
+
The `lock-renewal.ts` utility is at 5.71% coverage and is a critical component for long-running jobs. This is the biggest gap.
|
|
32
|
+
|
|
33
|
+
### Test Cases Required
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
describe('LockRenewal', () => {
|
|
37
|
+
describe('constructor', () => {
|
|
38
|
+
it('should initialize with store, jobId, lockTtl, and renewalInterval');
|
|
39
|
+
it('should default renewalInterval to lockTtl / 2 if not provided');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('start', () => {
|
|
43
|
+
it('should not start if store does not support extendLock');
|
|
44
|
+
it('should start interval that calls extendLock');
|
|
45
|
+
it('should stop if extendLock returns false');
|
|
46
|
+
it('should handle extendLock errors gracefully');
|
|
47
|
+
it('should unref the interval to not prevent process exit');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe('stop', () => {
|
|
51
|
+
it('should clear the interval');
|
|
52
|
+
it('should be safe to call multiple times');
|
|
53
|
+
it('should be safe to call before start');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('integration', () => {
|
|
57
|
+
it('should extend lock at regular intervals');
|
|
58
|
+
it('should stop extending after stop() is called');
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Estimated Impact**: +8% branch coverage
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Phase 2: BullMQ Batch Processing Tests
|
|
68
|
+
|
|
69
|
+
**File**: `test/bullmq.provider.spec.ts` (extend existing)
|
|
70
|
+
|
|
71
|
+
Lines 345-484 contain the batch processing logic that needs coverage.
|
|
72
|
+
|
|
73
|
+
### Test Cases Required
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
describe('BullMQ Batch Processing', () => {
|
|
77
|
+
describe('processBatch', () => {
|
|
78
|
+
it('should accumulate jobs until batchSize is reached');
|
|
79
|
+
it('should process partial batch on timeout');
|
|
80
|
+
it('should process jobs in parallel when parallel=true');
|
|
81
|
+
it('should process jobs sequentially when parallel=false');
|
|
82
|
+
it('should respect maxParallel limit');
|
|
83
|
+
it('should continue on error when continueOnError=true');
|
|
84
|
+
it('should stop on first error when continueOnError=false');
|
|
85
|
+
it('should retry failed jobs individually when retryFailedIndividually=true');
|
|
86
|
+
it('should call metrics.batchProcessed on success');
|
|
87
|
+
it('should call metrics.batchFailed on complete failure');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe('addBatch', () => {
|
|
91
|
+
it('should add multiple jobs with batch grouping');
|
|
92
|
+
it('should assign batchId to all jobs in batch');
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Estimated Impact**: +4% branch coverage
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Phase 3: ProcessorExplorer Batch Integration Tests
|
|
102
|
+
|
|
103
|
+
**File**: `test/processor.explorer.spec.ts` (extend existing)
|
|
104
|
+
|
|
105
|
+
Lines 203-232, 393-397, 457-458, 467-468 contain batch processor discovery logic.
|
|
106
|
+
|
|
107
|
+
### Test Cases Required
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
describe('ProcessorExplorer Batch Integration', () => {
|
|
111
|
+
describe('batch processor discovery', () => {
|
|
112
|
+
it('should discover methods decorated with @BatchProcess');
|
|
113
|
+
it('should register batch processor with correct options');
|
|
114
|
+
it('should use default batchSize when not specified');
|
|
115
|
+
it('should use default batchTimeout when not specified');
|
|
116
|
+
it('should handle parallel option correctly');
|
|
117
|
+
it('should handle maxParallel option correctly');
|
|
118
|
+
it('should handle continueOnError option correctly');
|
|
119
|
+
it('should handle retryFailedIndividually option correctly');
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
describe('batch processor execution', () => {
|
|
123
|
+
it('should call batch processor with accumulated jobs');
|
|
124
|
+
it('should respect circuit breaker for batch processing');
|
|
125
|
+
it('should emit metrics for batch processing');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
describe('mixed processors', () => {
|
|
129
|
+
it('should support both @Process and @BatchProcess on same class');
|
|
130
|
+
it('should route jobs to correct handler type');
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Estimated Impact**: +3% branch coverage
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Phase 4: Batch Decorator Tests
|
|
140
|
+
|
|
141
|
+
**File**: `test/decorators.spec.ts` (extend existing)
|
|
142
|
+
|
|
143
|
+
The `@BatchProcess` decorator at line 63 needs coverage.
|
|
144
|
+
|
|
145
|
+
### Test Cases Required
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
describe('@BatchProcess Decorator', () => {
|
|
149
|
+
it('should set BATCH_PROCESS_METADATA on method');
|
|
150
|
+
it('should store batchSize option');
|
|
151
|
+
it('should store batchTimeout option');
|
|
152
|
+
it('should store parallel option');
|
|
153
|
+
it('should store maxParallel option');
|
|
154
|
+
it('should store continueOnError option');
|
|
155
|
+
it('should store retryFailedIndividually option');
|
|
156
|
+
it('should use default values when options not provided');
|
|
157
|
+
});
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Estimated Impact**: +1% branch coverage
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Phase 5: Queue Provider Factory Tests
|
|
165
|
+
|
|
166
|
+
**File**: `test/queue.provider.spec.ts` (extend existing)
|
|
167
|
+
|
|
168
|
+
Lines 28-43 contain provider factory branches.
|
|
169
|
+
|
|
170
|
+
### Test Cases Required
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
describe('QueueProviderFactory', () => {
|
|
174
|
+
describe('createProvider', () => {
|
|
175
|
+
it('should create BullMQ provider when type is BULLMQ');
|
|
176
|
+
it('should create Kafka provider when type is KAFKA');
|
|
177
|
+
it('should create RabbitMQ provider when type is RABBITMQ');
|
|
178
|
+
it('should create Redis PubSub provider when type is REDIS_PUBSUB');
|
|
179
|
+
it('should throw error for unknown provider type');
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
describe('useInMemoryIdempotency', () => {
|
|
183
|
+
it('should auto-configure InMemoryIdempotencyStore when enabled');
|
|
184
|
+
it('should not override custom idempotency store');
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Estimated Impact**: +2% branch coverage
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Test Quality Review
|
|
194
|
+
|
|
195
|
+
### Current Test Quality Issues
|
|
196
|
+
|
|
197
|
+
1. **Insufficient Mocking**: Some tests rely on real behavior instead of mocking, leading to flaky tests.
|
|
198
|
+
2. **Missing Edge Cases**: Error paths and boundary conditions are often not tested.
|
|
199
|
+
3. **No Timer Testing**: `lock-renewal.ts` uses timers but no fake timers are used in tests.
|
|
200
|
+
|
|
201
|
+
### Recommendations
|
|
202
|
+
|
|
203
|
+
1. **Use Jest Fake Timers** for `lock-renewal.ts` and `delayed-scheduler.ts` tests.
|
|
204
|
+
2. **Mock External Dependencies** (Redis, RabbitMQ connections) consistently.
|
|
205
|
+
3. **Add Error Path Tests** for all async operations.
|
|
206
|
+
4. **Add Boundary Tests** for batch sizes (0, 1, max).
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Implementation Order
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
Phase 1: Lock Renewal Tests ← HIGHEST PRIORITY (5.71% → 90%+)
|
|
214
|
+
↓
|
|
215
|
+
Phase 2: BullMQ Batch Tests ← HIGH PRIORITY (covers 345-484)
|
|
216
|
+
↓
|
|
217
|
+
Phase 3: Explorer Batch Tests ← MEDIUM PRIORITY (covers 203-232)
|
|
218
|
+
↓
|
|
219
|
+
Phase 4: Decorator Tests ← LOW PRIORITY (small gap)
|
|
220
|
+
↓
|
|
221
|
+
Phase 5: Provider Factory Tests ← LOW PRIORITY (small gap)
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Estimated Total Impact**: +18% branch coverage (72.14% → 90%+)
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Acceptance Criteria
|
|
229
|
+
|
|
230
|
+
- [ ] Global branch coverage ≥ 80%
|
|
231
|
+
- [ ] `lock-renewal.ts` branch coverage ≥ 80%
|
|
232
|
+
- [ ] `bullmq.provider.ts` branch coverage ≥ 75%
|
|
233
|
+
- [ ] `processor.explorer.ts` branch coverage ≥ 80%
|
|
234
|
+
- [ ] All new tests pass consistently
|
|
235
|
+
- [ ] No test flakiness introduced
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Changeset (after tests pass)
|
|
240
|
+
|
|
241
|
+
```markdown
|
|
242
|
+
---
|
|
243
|
+
"@nathapp/nestjs-queue": patch
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
### Added
|
|
247
|
+
- Comprehensive unit tests for batch processing functionality
|
|
248
|
+
- Lock renewal utility tests with fake timers
|
|
249
|
+
- Provider factory branch tests
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
*Awaiting approval to proceed with implementation.*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nathapp/nestjs-queue",
|
|
3
|
-
"version": "2.1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "NestJS Queue Module with multi-provider support (BullMQ, Kafka, RabbitMQ, Redis Pub/Sub)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"author": "William Khoo",
|
|
21
21
|
"license": "ISC",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@nathapp/nestjs-common": "2.0.4",
|
|
24
23
|
"uuid": "^9.0.0"
|
|
25
24
|
},
|
|
26
25
|
"peerDependencies": {
|
|
26
|
+
"@nathapp/nestjs-common": "^2.1.0",
|
|
27
27
|
"@nestjs/common": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0",
|
|
28
28
|
"@nestjs/core": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0",
|
|
29
29
|
"bullmq": "^5.0.0",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
+
"@nathapp/nestjs-common": "^2.1.0",
|
|
53
54
|
"@nestjs/testing": "^11.0.0",
|
|
54
55
|
"@types/amqplib": "^0.10.0",
|
|
55
56
|
"@types/jest": "^29.5.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './redis-pubsub.provider';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./redis-pubsub.provider"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/provider/redis-pubsub/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { QueueProviderType } from '../../enum/provider.enum';
|
|
2
|
-
import { JobStatus } from '../../enum/job-status.enum';
|
|
3
|
-
import { QueueEvent } from '../../enum/queue-event.enum';
|
|
4
|
-
import { IJob, JobOptions, ProcessorOptions } from '../../interface/job.interface';
|
|
5
|
-
import { QueueProvider } from '../../interface/queue-provider.interface';
|
|
6
|
-
import { RedisPubSubOptions } from '../../interface/queue-options.interface';
|
|
7
|
-
import { HealthCheckResult } from '../../interface/health.interface';
|
|
8
|
-
export declare class RedisPubSubProvider extends QueueProvider {
|
|
9
|
-
private readonly options;
|
|
10
|
-
private readonly logger;
|
|
11
|
-
private readonly publisher;
|
|
12
|
-
private readonly subscribers;
|
|
13
|
-
private readonly keyPrefix;
|
|
14
|
-
private readonly eventListeners;
|
|
15
|
-
readonly type = QueueProviderType.REDIS_PUBSUB;
|
|
16
|
-
constructor(options: RedisPubSubOptions);
|
|
17
|
-
private generateJobId;
|
|
18
|
-
private getChannelName;
|
|
19
|
-
add<T>(queueName: string, jobName: string, data: T, opts?: JobOptions): Promise<IJob<T>>;
|
|
20
|
-
addBulk<T>(queueName: string, jobs: Array<{
|
|
21
|
-
name: string;
|
|
22
|
-
data: T;
|
|
23
|
-
opts?: JobOptions;
|
|
24
|
-
}>): Promise<IJob<T>[]>;
|
|
25
|
-
process<T>(queueName: string, processor: (job: IJob<T>) => Promise<any>, options?: ProcessorOptions): Promise<boolean>;
|
|
26
|
-
getJob<T>(queueName: string, jobId: string): Promise<IJob<T> | null>;
|
|
27
|
-
getJobs(queueName: string, status: JobStatus[], start?: number, end?: number): Promise<IJob[]>;
|
|
28
|
-
removeJob(queueName: string, jobId: string): Promise<void>;
|
|
29
|
-
pause(queueName: string): Promise<void>;
|
|
30
|
-
resume(queueName: string): Promise<void>;
|
|
31
|
-
clean(queueName: string, grace: number, status: JobStatus): Promise<string[]>;
|
|
32
|
-
on(queueName: string, event: QueueEvent, callback: (job: IJob, result?: any) => void, filter?: {
|
|
33
|
-
jobName?: string;
|
|
34
|
-
jobId?: string;
|
|
35
|
-
}): void;
|
|
36
|
-
off(queueName: string, event: QueueEvent, callback: (job: IJob, result?: any) => void): void;
|
|
37
|
-
removeAllListeners(queueName: string): void;
|
|
38
|
-
close(): Promise<void>;
|
|
39
|
-
isHealthy(): Promise<HealthCheckResult>;
|
|
40
|
-
}
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RedisPubSubProvider = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const ioredis_1 = require("ioredis");
|
|
6
|
-
const provider_enum_1 = require("../../enum/provider.enum");
|
|
7
|
-
const queue_provider_interface_1 = require("../../interface/queue-provider.interface");
|
|
8
|
-
const errors_1 = require("../../utils/errors");
|
|
9
|
-
const uuid_1 = require("uuid");
|
|
10
|
-
class RedisPubSubProvider extends queue_provider_interface_1.QueueProvider {
|
|
11
|
-
constructor(options) {
|
|
12
|
-
super();
|
|
13
|
-
this.options = options;
|
|
14
|
-
this.logger = new common_1.Logger(RedisPubSubProvider.name);
|
|
15
|
-
this.subscribers = new Map();
|
|
16
|
-
this.eventListeners = new Map();
|
|
17
|
-
this.type = provider_enum_1.QueueProviderType.REDIS_PUBSUB;
|
|
18
|
-
this.keyPrefix = options.keyPrefix || 'queue';
|
|
19
|
-
this.publisher = new ioredis_1.default({
|
|
20
|
-
host: options.host,
|
|
21
|
-
port: options.port,
|
|
22
|
-
password: options.password,
|
|
23
|
-
db: options.db,
|
|
24
|
-
tls: options.tls ? {} : undefined,
|
|
25
|
-
keyPrefix: this.keyPrefix ? `${this.keyPrefix}:` : undefined,
|
|
26
|
-
});
|
|
27
|
-
this.publisher.on('connect', () => {
|
|
28
|
-
this.logger.log('Redis Pub/Sub publisher connected');
|
|
29
|
-
});
|
|
30
|
-
this.publisher.on('error', (err) => {
|
|
31
|
-
this.logger.error(`Redis Pub/Sub publisher error: ${err.message}`);
|
|
32
|
-
});
|
|
33
|
-
this.logger.warn('Redis Pub/Sub provider initialized. ' +
|
|
34
|
-
'WARNING: This is NOT suitable for job queues. ' +
|
|
35
|
-
'Messages are fire-and-forget with no persistence or acknowledgment. ' +
|
|
36
|
-
'Use BullMQ, Kafka, or RabbitMQ for reliable job processing.');
|
|
37
|
-
}
|
|
38
|
-
generateJobId() {
|
|
39
|
-
return (0, uuid_1.v4)();
|
|
40
|
-
}
|
|
41
|
-
getChannelName(queueName) {
|
|
42
|
-
return this.keyPrefix ? `${this.keyPrefix}:${queueName}` : queueName;
|
|
43
|
-
}
|
|
44
|
-
async add(queueName, jobName, data, opts) {
|
|
45
|
-
if (opts === null || opts === void 0 ? void 0 : opts.delay) {
|
|
46
|
-
this.logger.warn('Redis Pub/Sub does not support delayed messages. Message will be published immediately.');
|
|
47
|
-
}
|
|
48
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.attempts) && opts.attempts > 1) {
|
|
49
|
-
this.logger.warn('Redis Pub/Sub does not support retries. Attempts setting will be ignored.');
|
|
50
|
-
}
|
|
51
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.priority) !== undefined) {
|
|
52
|
-
this.logger.warn('Redis Pub/Sub does not support priority. Priority setting will be ignored.');
|
|
53
|
-
}
|
|
54
|
-
const job = {
|
|
55
|
-
id: (opts === null || opts === void 0 ? void 0 : opts.jobId) || this.generateJobId(),
|
|
56
|
-
name: jobName,
|
|
57
|
-
data,
|
|
58
|
-
opts,
|
|
59
|
-
timestamp: Date.now(),
|
|
60
|
-
attemptsMade: 0,
|
|
61
|
-
};
|
|
62
|
-
const channel = this.getChannelName(queueName);
|
|
63
|
-
await this.publisher.publish(channel, JSON.stringify(job));
|
|
64
|
-
this.logger.debug(`Message published: ${jobName} (${job.id}) to channel ${channel}`);
|
|
65
|
-
return job;
|
|
66
|
-
}
|
|
67
|
-
async addBulk(queueName, jobs) {
|
|
68
|
-
const createdJobs = [];
|
|
69
|
-
for (const j of jobs) {
|
|
70
|
-
const job = await this.add(queueName, j.name, j.data, j.opts);
|
|
71
|
-
createdJobs.push(job);
|
|
72
|
-
}
|
|
73
|
-
this.logger.debug(`${createdJobs.length} messages published to channel ${queueName}`);
|
|
74
|
-
return createdJobs;
|
|
75
|
-
}
|
|
76
|
-
async process(queueName, processor, options) {
|
|
77
|
-
const channel = this.getChannelName(queueName);
|
|
78
|
-
if (this.subscribers.has(channel)) {
|
|
79
|
-
throw new errors_1.QueueError(`Subscriber already exists for channel ${channel}. Cannot register duplicate processor.`, 'SUBSCRIBER_EXISTS', queueName);
|
|
80
|
-
}
|
|
81
|
-
this.logger.warn(`Starting Redis Pub/Sub subscriber for ${channel}. ` +
|
|
82
|
-
'Note: All instances will receive ALL messages (fan-out). ' +
|
|
83
|
-
'This is NOT load-balanced across pods.');
|
|
84
|
-
const subscriber = new ioredis_1.default({
|
|
85
|
-
host: this.options.host,
|
|
86
|
-
port: this.options.port,
|
|
87
|
-
password: this.options.password,
|
|
88
|
-
db: this.options.db,
|
|
89
|
-
tls: this.options.tls ? {} : undefined,
|
|
90
|
-
});
|
|
91
|
-
await subscriber.subscribe(channel);
|
|
92
|
-
subscriber.on('message', async (receivedChannel, message) => {
|
|
93
|
-
if (receivedChannel !== channel)
|
|
94
|
-
return;
|
|
95
|
-
try {
|
|
96
|
-
const job = JSON.parse(message);
|
|
97
|
-
if ((options === null || options === void 0 ? void 0 : options.name) && job.name !== options.name) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
try {
|
|
101
|
-
await processor(job);
|
|
102
|
-
this.logger.debug(`Message processed: ${job.name} (${job.id})`);
|
|
103
|
-
}
|
|
104
|
-
catch (error) {
|
|
105
|
-
this.logger.error(`Message processing failed: ${job.name} (${job.id}): ${error.message}`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
catch (parseError) {
|
|
109
|
-
this.logger.error(`Failed to parse message: ${parseError.message}`);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
this.subscribers.set(channel, subscriber);
|
|
113
|
-
this.logger.log(`Subscriber started for channel: ${channel}`);
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
async getJob(queueName, jobId) {
|
|
117
|
-
this.logger.warn('getJob is not supported in Redis Pub/Sub. Messages are not persisted.');
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
|
-
async getJobs(queueName, status, start = 0, end = 100) {
|
|
121
|
-
this.logger.warn('getJobs is not supported in Redis Pub/Sub. Messages are not persisted.');
|
|
122
|
-
return [];
|
|
123
|
-
}
|
|
124
|
-
async removeJob(queueName, jobId) {
|
|
125
|
-
this.logger.warn('removeJob is not supported in Redis Pub/Sub. Messages are not persisted.');
|
|
126
|
-
}
|
|
127
|
-
async pause(queueName) {
|
|
128
|
-
const channel = this.getChannelName(queueName);
|
|
129
|
-
const subscriber = this.subscribers.get(channel);
|
|
130
|
-
if (subscriber) {
|
|
131
|
-
await subscriber.unsubscribe(channel);
|
|
132
|
-
this.logger.log(`Subscriber paused for channel: ${channel}`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
async resume(queueName) {
|
|
136
|
-
const channel = this.getChannelName(queueName);
|
|
137
|
-
const subscriber = this.subscribers.get(channel);
|
|
138
|
-
if (subscriber) {
|
|
139
|
-
await subscriber.subscribe(channel);
|
|
140
|
-
this.logger.log(`Subscriber resumed for channel: ${channel}`);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
async clean(queueName, grace, status) {
|
|
144
|
-
this.logger.warn('clean is not supported in Redis Pub/Sub. Messages are not persisted.');
|
|
145
|
-
return [];
|
|
146
|
-
}
|
|
147
|
-
on(queueName, event, callback, filter) {
|
|
148
|
-
if (!this.eventListeners.has(queueName)) {
|
|
149
|
-
this.eventListeners.set(queueName, new Map());
|
|
150
|
-
}
|
|
151
|
-
const queueListeners = this.eventListeners.get(queueName);
|
|
152
|
-
if (!queueListeners.has(event)) {
|
|
153
|
-
queueListeners.set(event, []);
|
|
154
|
-
}
|
|
155
|
-
const filteredCallback = (job, result) => {
|
|
156
|
-
if ((filter === null || filter === void 0 ? void 0 : filter.jobName) && job.name !== filter.jobName)
|
|
157
|
-
return;
|
|
158
|
-
if ((filter === null || filter === void 0 ? void 0 : filter.jobId) && job.id !== filter.jobId)
|
|
159
|
-
return;
|
|
160
|
-
callback(job, result);
|
|
161
|
-
};
|
|
162
|
-
filteredCallback._originalCallback = callback;
|
|
163
|
-
queueListeners.get(event).push(filteredCallback);
|
|
164
|
-
this.logger.debug(`Event listener registered for queue ${queueName}, event ${event}`);
|
|
165
|
-
}
|
|
166
|
-
off(queueName, event, callback) {
|
|
167
|
-
const queueListeners = this.eventListeners.get(queueName);
|
|
168
|
-
if (!queueListeners)
|
|
169
|
-
return;
|
|
170
|
-
const listeners = queueListeners.get(event);
|
|
171
|
-
if (!listeners)
|
|
172
|
-
return;
|
|
173
|
-
const index = listeners.findIndex((cb) => cb === callback || cb._originalCallback === callback);
|
|
174
|
-
if (index > -1) {
|
|
175
|
-
listeners.splice(index, 1);
|
|
176
|
-
this.logger.debug(`Event listener removed for queue ${queueName}, event ${event}`);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
removeAllListeners(queueName) {
|
|
180
|
-
this.eventListeners.delete(queueName);
|
|
181
|
-
this.logger.debug(`All event listeners removed for queue ${queueName}`);
|
|
182
|
-
}
|
|
183
|
-
async close() {
|
|
184
|
-
this.logger.log('Closing Redis Pub/Sub connections...');
|
|
185
|
-
for (const [channel, subscriber] of this.subscribers) {
|
|
186
|
-
await subscriber.quit();
|
|
187
|
-
this.logger.debug(`Subscriber closed: ${channel}`);
|
|
188
|
-
}
|
|
189
|
-
this.subscribers.clear();
|
|
190
|
-
await this.publisher.quit();
|
|
191
|
-
this.logger.debug('Publisher closed');
|
|
192
|
-
this.eventListeners.clear();
|
|
193
|
-
this.logger.log('All Redis Pub/Sub connections closed');
|
|
194
|
-
}
|
|
195
|
-
async isHealthy() {
|
|
196
|
-
const timestamp = Date.now();
|
|
197
|
-
try {
|
|
198
|
-
const start = Date.now();
|
|
199
|
-
await this.publisher.ping();
|
|
200
|
-
const latencyMs = Date.now() - start;
|
|
201
|
-
const connections = [
|
|
202
|
-
{ name: 'publisher', status: 'connected' }
|
|
203
|
-
];
|
|
204
|
-
for (const [name] of this.subscribers) {
|
|
205
|
-
connections.push({ name: `subscriber:${name}`, status: 'connected' });
|
|
206
|
-
}
|
|
207
|
-
return {
|
|
208
|
-
healthy: true,
|
|
209
|
-
provider: 'redis-pubsub',
|
|
210
|
-
connections,
|
|
211
|
-
latencyMs,
|
|
212
|
-
timestamp,
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
catch (error) {
|
|
216
|
-
return {
|
|
217
|
-
healthy: false,
|
|
218
|
-
provider: 'redis-pubsub',
|
|
219
|
-
connections: [{ name: 'publisher', status: 'error', error: error.message }],
|
|
220
|
-
timestamp,
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
exports.RedisPubSubProvider = RedisPubSubProvider;
|
|
226
|
-
//# sourceMappingURL=redis-pubsub.provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redis-pubsub.provider.js","sourceRoot":"","sources":["../../../lib/provider/redis-pubsub/redis-pubsub.provider.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,qCAA4B;AAC5B,4DAA6D;AAI7D,uFAAyE;AAGzE,+CAAgD;AAChD,+BAAoC;AAoBpC,MAAa,mBAAoB,SAAQ,wCAAa;IASpD,YAA6B,OAA2B;QACtD,KAAK,EAAE,CAAC;QADmB,YAAO,GAAP,OAAO,CAAoB;QARvC,WAAM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