@fluojs/queue
Advanced tools
| import type { ApplicationLogger } from '@fluojs/runtime'; | ||
| import type { NormalizedQueueModuleOptions, QueueWorkerDescriptor } from './types.js'; | ||
| /** | ||
| * Describes the queue dead letter job contract. | ||
| */ | ||
| export interface QueueDeadLetterJob { | ||
@@ -12,2 +15,5 @@ attemptsMade: number; | ||
| } | ||
| /** | ||
| * Describes the queue redis dead letter client contract. | ||
| */ | ||
| export interface QueueRedisDeadLetterClient { | ||
@@ -17,2 +23,5 @@ ltrim(key: string, start: number, stop: number): Promise<unknown>; | ||
| } | ||
| /** | ||
| * Represents the queue dead letter manager. | ||
| */ | ||
| export declare class QueueDeadLetterManager { | ||
@@ -19,0 +28,0 @@ private readonly options; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"dead-letter-manager.d.ts","sourceRoot":"","sources":["../src/dead-letter-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,OAAO,KAAK,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAMtF,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE;QACJ,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClE,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACrD;AAED,qBAAa,sBAAsB;IAI/B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,Q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ACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IALjC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;gBAGvC,OAAO,EAAE,4BAA4B,EACrC,MAAM,EAAE,iBAAiB,EACzB,cAAc,EAAE,MAAM,0BAA0B;IAGnE,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAED,oBAAoB,CAAC,UAAU,EAAE,qBAAqB,EAAE,GAAG,EAAE,kBAAkB,GAAG,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAY1G,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;YAmB3B,sBAAsB;IA+BpC,OAAO,CAAC,iBAAiB;CAQ1B"} |
| import { cloneWithFallback } from '@fluojs/core/internal'; | ||
| import { normalizePositiveInteger, withTimeout } from './helpers.js'; | ||
| const DEAD_LETTER_DRAIN_TIMEOUT_MS = 5_000; | ||
| /** | ||
| * Describes the queue dead letter job contract. | ||
| */ | ||
| /** | ||
| * Describes the queue redis dead letter client contract. | ||
| */ | ||
| /** | ||
| * Represents the queue dead letter manager. | ||
| */ | ||
| export class QueueDeadLetterManager { | ||
@@ -5,0 +17,0 @@ pendingWrites = new Set(); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAuB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAExF,KAAK,kBAAkB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAgBpF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,GAAE,kBAAuB,GAAG,kBAAkB,CAWvG"} | ||
| {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAuB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAExF,KAAK,kBAAkB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAiBpF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,GAAE,kBAAuB,GAAG,kBAAkB,CAWvG"} |
@@ -1,5 +0,5 @@ | ||
| import { metadataSymbol } from '@fluojs/core/internal'; | ||
| import { ensureMetadataSymbol } from '@fluojs/core/internal'; | ||
| import { queueWorkerMetadataSymbol } from './metadata.js'; | ||
| ensureMetadataSymbol(); | ||
| function getStandardMetadataBag(metadata) { | ||
| void metadataSymbol; | ||
| return metadata; | ||
@@ -6,0 +6,0 @@ } |
+52
-0
@@ -5,3 +5,9 @@ import { type Token } from '@fluojs/core'; | ||
| import type { QueueRateLimiterOptions } from './types.js'; | ||
| /** | ||
| * Defines the scope type. | ||
| */ | ||
| export type Scope = 'request' | 'singleton' | 'transient'; | ||
| /** | ||
| * Describes the discovery candidate contract. | ||
| */ | ||
| export interface DiscoveryCandidate { | ||
@@ -13,3 +19,15 @@ moduleName: string; | ||
| } | ||
| /** | ||
| * Scope from provider. | ||
| * | ||
| * @param provider The provider. | ||
| * @returns The scope from provider result. | ||
| */ | ||
| export declare function scopeFromProvider(provider: Provider): Scope; | ||
| /** | ||
| * Is class provider. | ||
| * | ||
| * @param provider The provider. | ||
| * @returns The is class provider result. | ||
| */ | ||
| export declare function isClassProvider(provider: Provider): provider is Extract<Provider, { | ||
@@ -19,7 +37,41 @@ provide: Token; | ||
| }>; | ||
| /** | ||
| * Collect discovery candidates. | ||
| * | ||
| * @param compiledModules The compiled modules. | ||
| * @returns The collect discovery candidates result. | ||
| */ | ||
| export declare function collectDiscoveryCandidates(compiledModules: readonly CompiledModule[]): DiscoveryCandidate[]; | ||
| /** | ||
| * Normalize positive integer. | ||
| * | ||
| * @param value The value. | ||
| * @param fallback The fallback. | ||
| * @returns The normalize positive integer result. | ||
| */ | ||
| export declare function normalizePositiveInteger(value: number | undefined, fallback: number): number; | ||
| /** | ||
| * Normalize positive integer or false. | ||
| * | ||
| * @param value The value. | ||
| * @param fallback The fallback. | ||
| * @returns The normalize positive integer or false result. | ||
| */ | ||
| export declare function normalizePositiveIntegerOrFalse(value: number | false | undefined, fallback: number | false): number | false; | ||
| /** | ||
| * Normalize rate limiter. | ||
| * | ||
| * @param rateLimiter The rate limiter. | ||
| * @returns The normalize rate limiter result. | ||
| */ | ||
| export declare function normalizeRateLimiter(rateLimiter: QueueRateLimiterOptions | undefined): QueueRateLimiterOptions | undefined; | ||
| /** | ||
| * With timeout. | ||
| * | ||
| * @param promise The promise. | ||
| * @param timeoutMs The timeout ms. | ||
| * @param timeoutErrorFactory The timeout error factory. | ||
| * @returns The with timeout result. | ||
| */ | ||
| export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, timeoutErrorFactory: () => Error): Promise<T>; | ||
| //# sourceMappingURL=helpers.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1D,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,CAAC;AAE1D,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,QAAQ,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC;CACd;AAED,wBAAg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AAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,QAAQ,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,KAAK,CAU3D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,OAAO,CAAC,QAAQ,EAAE;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC,CAEzH;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,eAAe,EAAE,SAAS,cAAc,EAAE,GAAG,kBAAkB,EAAE,CAoC3G;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAY5F;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,EACjC,QAAQ,EAAE,MAAM,GAAG,KAAK,GACvB,MAAM,GAAG,KAAK,CAgBhB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,uBAAuB,GAAG,SAAS,GAAG,uBAAuB,GAAG,SAAS,CAS1H;AAED;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,SAAS,EAAE,MAAM,EACjB,mBAAmB,EAAE,MAAM,KAAK,GAC/B,OAAO,CAAC,CAAC,CAAC,CAeZ"} |
+61
-0
| import { getClassDiMetadata } from '@fluojs/core/internal'; | ||
| /** | ||
| * Defines the scope type. | ||
| */ | ||
| /** | ||
| * Describes the discovery candidate contract. | ||
| */ | ||
| /** | ||
| * Scope from provider. | ||
| * | ||
| * @param provider The provider. | ||
| * @returns The scope from provider result. | ||
| */ | ||
| export function scopeFromProvider(provider) { | ||
@@ -11,5 +26,19 @@ if (typeof provider === 'function') { | ||
| } | ||
| /** | ||
| * Is class provider. | ||
| * | ||
| * @param provider The provider. | ||
| * @returns The is class provider result. | ||
| */ | ||
| export function isClassProvider(provider) { | ||
| return typeof provider === 'object' && provider !== null && 'useClass' in provider; | ||
| } | ||
| /** | ||
| * Collect discovery candidates. | ||
| * | ||
| * @param compiledModules The compiled modules. | ||
| * @returns The collect discovery candidates result. | ||
| */ | ||
| export function collectDiscoveryCandidates(compiledModules) { | ||
@@ -48,2 +77,10 @@ const candidates = []; | ||
| } | ||
| /** | ||
| * Normalize positive integer. | ||
| * | ||
| * @param value The value. | ||
| * @param fallback The fallback. | ||
| * @returns The normalize positive integer result. | ||
| */ | ||
| export function normalizePositiveInteger(value, fallback) { | ||
@@ -59,2 +96,10 @@ if (value === undefined || !Number.isFinite(value)) { | ||
| } | ||
| /** | ||
| * Normalize positive integer or false. | ||
| * | ||
| * @param value The value. | ||
| * @param fallback The fallback. | ||
| * @returns The normalize positive integer or false result. | ||
| */ | ||
| export function normalizePositiveIntegerOrFalse(value, fallback) { | ||
@@ -73,2 +118,9 @@ if (value === false) { | ||
| } | ||
| /** | ||
| * Normalize rate limiter. | ||
| * | ||
| * @param rateLimiter The rate limiter. | ||
| * @returns The normalize rate limiter result. | ||
| */ | ||
| export function normalizeRateLimiter(rateLimiter) { | ||
@@ -83,2 +135,11 @@ if (!rateLimiter) { | ||
| } | ||
| /** | ||
| * With timeout. | ||
| * | ||
| * @param promise The promise. | ||
| * @param timeoutMs The timeout ms. | ||
| * @param timeoutErrorFactory The timeout error factory. | ||
| * @returns The with timeout result. | ||
| */ | ||
| export async function withTimeout(promise, timeoutMs, timeoutErrorFactory) { | ||
@@ -85,0 +146,0 @@ let timeoutId; |
+15
-0
| import type { QueueWorkerMetadata } from './types.js'; | ||
| /** | ||
| * Define queue worker metadata. | ||
| * | ||
| * @param target The target. | ||
| * @param metadata The metadata. | ||
| */ | ||
| export declare function defineQueueWorkerMetadata(target: Function, metadata: QueueWorkerMetadata): void; | ||
| /** | ||
| * Get queue worker metadata. | ||
| * | ||
| * @param target The target. | ||
| * @returns The get queue worker metadata result. | ||
| */ | ||
| export declare function getQueueWorkerMetadata(target: Function): QueueWorkerMetadata | undefined; | ||
| /** | ||
| * Provides the queue worker metadata symbol value. | ||
| */ | ||
| export declare const queueWorkerMetadataSymbol: symbol; | ||
| //# sourceMappingURL=metadata.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAkBtD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAE/F;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,QAAQ,GAAG,mBAAmB,GAAG,SAAS,CASxF;AAED,eAAO,MAAM,yBAAyB,QAAiC,CAAC"} | ||
| {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAkBtD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAE/F;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,QAAQ,GAAG,mBAAmB,GAAG,SAAS,CASxF;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAiC,CAAC"} |
+18
-0
@@ -16,5 +16,19 @@ import { ensureSymbolMetadataPolyfill, getStandardMetadataBag } from '@fluojs/core/internal'; | ||
| } | ||
| /** | ||
| * Define queue worker metadata. | ||
| * | ||
| * @param target The target. | ||
| * @param metadata The metadata. | ||
| */ | ||
| export function defineQueueWorkerMetadata(target, metadata) { | ||
| queueWorkerMetadataStore.set(target, cloneQueueWorkerMetadata(metadata)); | ||
| } | ||
| /** | ||
| * Get queue worker metadata. | ||
| * | ||
| * @param target The target. | ||
| * @returns The get queue worker metadata result. | ||
| */ | ||
| export function getQueueWorkerMetadata(target) { | ||
@@ -28,2 +42,6 @@ const stored = queueWorkerMetadataStore.get(target); | ||
| } | ||
| /** | ||
| * Provides the queue worker metadata symbol value. | ||
| */ | ||
| export const queueWorkerMetadataSymbol = standardQueueWorkerMetadataKey; |
| import type { ApplicationLogger, CompiledModule } from '@fluojs/runtime'; | ||
| import type { NormalizedQueueModuleOptions, QueueJobType, QueueWorkerDescriptor } from './types.js'; | ||
| /** | ||
| * Discover queue worker descriptors. | ||
| * | ||
| * @param compiledModules The compiled modules. | ||
| * @param options The options. | ||
| * @param logger The logger. | ||
| * @returns The discover queue worker descriptors result. | ||
| */ | ||
| export declare function discoverQueueWorkerDescriptors(compiledModules: readonly CompiledModule[], options: NormalizedQueueModuleOptions, logger: ApplicationLogger): Map<QueueJobType, QueueWorkerDescriptor>; | ||
| //# sourceMappingURL=worker-discovery.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"worker-discovery.d.ts","sourceRoot":"","sources":["../src/worker-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIzE,OAAO,KAAK,EAAE,4BAA4B,EAAE,YAAY,EAAE,qBAAqB,EAAuB,MAAM,YAAY,CAAC;AAEzH,wBAAgB,8BAA8B,CAC5C,eAAe,EAAE,SAAS,cAAc,EAAE,EAC1C,OAAO,EAAE,4BAA4B,EACrC,MAAM,EAAE,iBAAiB,GACxB,GAAG,CAAC,YAAY,EAAE,qBAAqB,CAAC,CA4C1C"} | ||
| {"version":3,"file":"worker-discovery.d.ts","sourceRoot":"","sources":["../src/worker-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIzE,OAAO,KAAK,EAAE,4BAA4B,EAAE,YAAY,EAAE,qBAAqB,EAAuB,MAAM,YAAY,CAAC;AAEzH;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAC5C,eAAe,EAAE,SAAS,cAAc,EAAE,EAC1C,OAAO,EAAE,4BAA4B,EACrC,MAAM,EAAE,iBAAiB,GACxB,GAAG,CAAC,YAAY,EAAE,qBAAqB,CAAC,CA4C1C"} |
| import { getQueueWorkerMetadata } from './metadata.js'; | ||
| import { collectDiscoveryCandidates, normalizePositiveInteger, normalizeRateLimiter } from './helpers.js'; | ||
| /** | ||
| * Discover queue worker descriptors. | ||
| * | ||
| * @param compiledModules The compiled modules. | ||
| * @param options The options. | ||
| * @param logger The logger. | ||
| * @returns The discover queue worker descriptors result. | ||
| */ | ||
| export function discoverQueueWorkerDescriptors(compiledModules, options, logger) { | ||
@@ -4,0 +12,0 @@ const descriptorsByJobType = new Map(); |
+4
-4
@@ -13,3 +13,3 @@ { | ||
| ], | ||
| "version": "1.0.0-beta.2", | ||
| "version": "1.0.0-beta.3", | ||
| "private": false, | ||
@@ -42,6 +42,6 @@ "license": "MIT", | ||
| "bullmq": "^5.58.0", | ||
| "@fluojs/core": "^1.0.0-beta.2", | ||
| "@fluojs/di": "^1.0.0-beta.3", | ||
| "@fluojs/core": "^1.0.0-beta.4", | ||
| "@fluojs/di": "^1.0.0-beta.6", | ||
| "@fluojs/redis": "^1.0.0-beta.2", | ||
| "@fluojs/runtime": "^1.0.0-beta.3" | ||
| "@fluojs/runtime": "^1.0.0-beta.11" | ||
| }, | ||
@@ -48,0 +48,0 @@ "devDependencies": { |
+13
-6
@@ -5,3 +5,3 @@ # @fluojs/queue | ||
| fluo를 위한 Redis 기반 분산 작업 처리 패키지입니다. 데코레이터 기반의 워커 탐색, 자동 작업 직렬화, 그리고 수명 주기 관리 기능을 제공합니다. | ||
| fluo를 위한 Redis 기반 분산 작업 처리 패키지입니다. 데코레이터 기반의 워커 탐색, JSON-safe 작업 직렬화, 그리고 수명 주기 관리 기능을 제공합니다. | ||
@@ -56,6 +56,4 @@ ## 목차 | ||
| `QueueModule.forRoot(...)`는 큐 등록을 위한 지원되는 루트 엔트리포인트입니다. | ||
| `QueueModule.forRoot(...)`는 애플리케이션 수준 큐 등록을 위한 지원되는 루트 엔트리포인트입니다. | ||
| 큐 등록은 `QueueModule.forRoot(...)`로 구성합니다. | ||
| ```typescript | ||
@@ -110,6 +108,8 @@ import { Module, Inject } from '@fluojs/core'; | ||
| 모든 재시도에 실패한 작업은 Redis의 데드 레터 리스트(`fluo:queue:dead-letter:<jobName>`)로 자동 이동되어, 나중에 수동으로 확인하거나 복구할 수 있습니다. | ||
| 워커가 모든 재시도를 소진하면 Queue는 Redis의 데드 레터 리스트(`fluo:queue:dead-letter:<jobName>`)에 레코드를 append하여, 나중에 수동으로 확인하거나 복구할 수 있게 합니다. BullMQ job 자체를 이동시키는 것은 아닙니다. | ||
| `QueueModule.forRoot()`는 기본적으로 작업별 최근 데드 레터 엔트리 `1_000`개만 유지합니다. 무제한 보관이 꼭 필요하면 `defaultDeadLetterMaxEntries: false`로 opt-out 하고, 더 엄격한 운영 예산이 필요하면 더 작은 양의 정수를 지정하세요. | ||
| Job은 JSON으로 직렬화 가능한 plain object여야 합니다. Queue는 enqueue 전에 job payload를 직렬화하고, worker 측에서 job prototype을 다시 입힙니다. | ||
| 저수준 provider 조합을 루트 barrel API의 일부가 아니라 내부 구현 세부사항으로 취급해야 합니다. 저수준 provider helper는 문서화된 루트 barrel 계약에 포함되지 않습니다. | ||
@@ -124,9 +124,15 @@ | ||
| - `@QueueWorker(JobClass, options?)`: 특정 작업을 처리할 핸들러를 지정하는 데코레이터입니다. | ||
| - `QUEUE`: queue facade를 위한 호환성 주입 토큰입니다. | ||
| - `createQueuePlatformStatusSnapshot(...)`: lifecycle/readiness diagnostics를 위한 status snapshot helper입니다. | ||
| ### 타입 | ||
| - `QueueModuleOptions`: 전역 큐 설정(clientName, 기본 시도 횟수, 동시성, 전송률 제한 등)을 위한 타입입니다. | ||
| - `QueueModuleOptions`: 전역 큐 설정(clientName, 기본 시도 횟수, `defaultBackoff`, 동시성, 전송률 제한, dead-letter retention 등)을 위한 타입입니다. | ||
| - `QueueWorkerOptions`: 개별 작업 설정(시도 횟수, 백오프, 동시성, jobName, 전송률 제한 등)을 위한 타입입니다. | ||
| - `QueueBackoffOptions`: 재시도 백오프 설정(`type`, `delayMs`)을 위한 타입입니다. | ||
| `QueueModuleOptions`에는 `defaultDeadLetterMaxEntries` 같은 dead-letter retention 설정도 포함됩니다. | ||
| singleton `@QueueWorker()` provider/controller만 등록됩니다. request/transient worker는 discovery 중 건너뜁니다. | ||
| ## 관련 패키지 | ||
@@ -141,1 +147,2 @@ | ||
| - `packages/queue/src/public-surface.test.ts`: 공개 API 계약 검증 예제. | ||
| - `packages/queue/src/status.test.ts`: Queue lifecycle status snapshot 테스트 예제. |
+11
-6
@@ -5,3 +5,3 @@ # @fluojs/queue | ||
| Redis-backed distributed job processing for fluo. It features decorator-based worker discovery, automatic job serialization, and lifecycle-managed execution. | ||
| Redis-backed distributed job processing for fluo. It features decorator-based worker discovery, JSON-safe job serialization, and lifecycle-managed execution. | ||
@@ -56,6 +56,4 @@ ## Table of Contents | ||
| `QueueModule.forRoot(...)` is the supported root entrypoint for queue registration. | ||
| `QueueModule.forRoot(...)` is the supported root entrypoint for application-level queue registration. | ||
| Use `QueueModule.forRoot(...)` for application-level queue registration. | ||
| ```typescript | ||
@@ -110,6 +108,8 @@ import { Module, Inject } from '@fluojs/core'; | ||
| Jobs that fail all retry attempts are automatically moved to a dead-letter list in Redis (`fluo:queue:dead-letter:<jobName>`) for manual inspection or recovery. | ||
| When a worker exhausts its retry attempts, Queue appends a dead-letter record to Redis (`fluo:queue:dead-letter:<jobName>`) for manual inspection or recovery. Queue does not move the BullMQ job itself. | ||
| `QueueModule.forRoot()` keeps the most recent `1_000` dead-letter entries per job by default. Set `defaultDeadLetterMaxEntries: false` to opt out, or provide a smaller positive number when operators need a tighter retention budget. | ||
| Jobs must be JSON-serializable plain objects. Queue serializes the job payload before enqueueing and rehydrates the job prototype on the worker side. | ||
| Treat low-level provider assembly as an internal implementation detail: low-level provider helpers are not part of the documented root-barrel contract. | ||
@@ -124,6 +124,8 @@ | ||
| - `@QueueWorker(JobClass, options?)`: Decorator to mark a class as a job handler. | ||
| - `QUEUE`: Compatibility injection token for the queue facade. | ||
| - `createQueuePlatformStatusSnapshot(...)`: Status snapshot helper for lifecycle/readiness diagnostics. | ||
| ### Types | ||
| - `QueueModuleOptions`: Global queue settings (clientName, default attempts, concurrency, rate limiting). | ||
| - `QueueModuleOptions`: Global queue settings (clientName, default attempts, `defaultBackoff`, concurrency, rate limiting, dead-letter retention). | ||
| - `QueueWorkerOptions`: Per-job settings (attempts, backoff, concurrency, jobName, rate limiting). | ||
@@ -134,2 +136,4 @@ - `QueueBackoffOptions`: Retry backoff settings (`type`, `delayMs`). | ||
| Only singleton `@QueueWorker()` providers/controllers are registered. Request/transient workers are skipped during discovery. | ||
| ## Related Packages | ||
@@ -144,1 +148,2 @@ | ||
| - `packages/queue/src/public-surface.test.ts`: Public API contract verification. | ||
| - `packages/queue/src/status.test.ts`: Queue lifecycle status snapshot tests. |
72204
7.61%1269
15.26%144
3.6%Updated
Updated