nestjs-power-queues 1.0.14 → 1.0.16

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.
Files changed (2) hide show
  1. package/README.md +22 -83
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,28 +1,21 @@
1
- # nestjs-power-queues — Secure, Scalable & Production‑Ready power-queues Integration for NestJS
1
+ # nestjs-power-queues
2
2
 
3
- This module is a **dedicated, production-ready NestJS wrapper around `power-queues`** a high‑performance Redis abstraction layer for Node.js.
4
-
5
- It is a **structured, type-safe, and feature-rich integration** designed specifically to bring all the power of `power-queues` into the NestJS ecosystem with zero friction.
3
+ ## power-queues integration for NestJS
6
4
 
7
5
  <p align="center">
8
- <img src="https://img.shields.io/badge/redis-streams-red?logo=redis" />
9
- <img src="https://img.shields.io/badge/nodejs-queue-green?logo=node.js" />
10
- <img src="https://img.shields.io/badge/typescript-ready-blue?logo=typescript" />
11
- <img src="https://img.shields.io/badge/license-MIT-lightgrey" />
12
- <img src="https://img.shields.io/badge/nestjs-support-ea2845?logo=nestjs" />
13
- <img src="https://img.shields.io/badge/status-production-success" />
6
+ <img src="https://img.shields.io/badge/redis-streams-red?logo=redis" />
7
+ <img src="https://img.shields.io/badge/nodejs-queue-green?logo=node.js" />
8
+ <img src="https://img.shields.io/badge/typescript-ready-blue?logo=typescript" />
9
+ <img src="https://img.shields.io/badge/license-MIT-lightgrey" />
10
+ <img src="https://img.shields.io/badge/nestjs-support-ea2845?logo=nestjs" />
11
+ <img src="https://img.shields.io/badge/status-production-success" />
14
12
  </p>
15
13
 
16
- ---
17
-
18
14
  ## 📚 Documentation
19
-
20
15
  Full documentation is available here:
21
16
  👉 **https://nestjs-power-queues.docs.ihor.bielchenko.com**
22
17
 
23
- ---
24
-
25
- # 📦 Installation
18
+ ## 📦 Installation
26
19
 
27
20
  ``` bash
28
21
  npm install nestjs-power-queues
@@ -31,46 +24,18 @@ OR
31
24
  ```bash
32
25
  yarn add nestjs-power-queues
33
26
  ```
34
- ---
35
-
36
- # 🧪 Quick Start Example
37
-
38
- ## For example, you need to specify 2 connections: `queues1` and `queues2`
39
-
40
- ### 1. 🔐 Environment Variables (power-redis -Friendly)
41
-
42
- Everything is configured using environment variables:
43
-
44
- ```env
45
- REDIS_<NAME>_HOST=127.0.0.1
46
- REDIS_<NAME>_PORT=6379
47
- REDIS_<NAME>_PASSWORD=pass
48
- REDIS_<NAME>_DATABASE=0
49
-
50
- # TLS
51
- REDIS_<NAME>_TLS_CRT=/etc/ssl/client.crt
52
- REDIS_<NAME>_TLS_KEY=/etc/ssl/client.key
53
- REDIS_<NAME>_TLS_CA_CRT=/etc/ssl/ca.crt
54
- ```
55
27
 
56
- Instead of `<NAME>` you need to specify a custom connection name and then specify these names in `QueueModule.forRoot` (allowed in lowercase).
57
- For example:
28
+ ## 🧪 Basic usage
58
29
 
30
+ ### 1. Connection settings are specified in the .env file:
59
31
  ```env
60
- REDIS_QUEUES1_HOST=127.0.0.1
61
- REDIS_QUEUES1_PORT=6379
62
- REDIS_QUEUES1_PASSWORD=
63
- REDIS_QUEUES1_DATABASE=0
64
-
65
- REDIS_QUEUES2_HOST=127.0.0.1
66
- REDIS_QUEUES2_PORT=6379
67
- REDIS_QUEUES2_PASSWORD=
68
- REDIS_QUEUES2_DATABASE=0
32
+ REDIS_QUEUES_HOST=127.0.0.1
33
+ REDIS_QUEUES_PORT=6379
34
+ REDIS_QUEUES_PASSWORD=
35
+ REDIS_QUEUES_DATABASE=0
69
36
  ```
70
37
 
71
- TLS fields are optional.
72
-
73
- ---
38
+ For information on creating connections to Redis, see **[nestjs-power-redis](https://www.npmjs.com/package/nestjs-power-redis)**
74
39
 
75
40
  ### 2. Register module with multiple Redis clients
76
41
 
@@ -79,14 +44,12 @@ import { QueueModule } from 'nestjs-power-queues';
79
44
 
80
45
  @Module({
81
46
  imports: [
82
- QueueModule.forRoot([ 'queues1', 'queues2' ]),
47
+ QueueModule.forRoot([ 'queues' ]),
83
48
  ],
84
49
  })
85
50
  export class AppModule {}
86
51
  ```
87
52
 
88
- ---
89
-
90
53
  ### 3. Inject in a service
91
54
 
92
55
  ```ts
@@ -99,19 +62,18 @@ import {
99
62
  @Injectable()
100
63
  export class MyService {
101
64
  constructor(
102
- @InjectQueue('queues1') private readonly queueService1: QueueService,
103
- @InjectQueue('queues2') private readonly queueService2: QueueService,
65
+ @InjectQueue('queues') private readonly queueService: QueueService,
104
66
  ) {}
105
67
 
106
68
  async test() {
107
- await this.queueService1.addTasks('example:jobs', [
69
+ await this.queueService.addTasks('example:jobs', [
108
70
  { payload },
109
71
  ]);
110
72
  }
111
73
  }
112
74
  ```
113
75
 
114
- ### 3. Create job processor
76
+ ### 4. Create worker
115
77
 
116
78
  ```ts
117
79
  import { Injectable } from '@nestjs/common';
@@ -129,7 +91,7 @@ export class MyService extends QueueService {
129
91
  public readonly executeBatchAtOnce: boolean = true;
130
92
 
131
93
  constructor(
132
- @InjectRedis('queues1') public readonly redisService: RedisService,
94
+ @InjectRedis('queues') public readonly redisService: RedisService,
133
95
  ) {}
134
96
 
135
97
  async onExecute(id, payload) {
@@ -140,28 +102,5 @@ export class MyService extends QueueService {
140
102
 
141
103
  The `runOnInit` parameter determines whether queue processing should start immediately after the application starts.
142
104
 
143
- ---
144
-
145
- ## 🏗️ How It Works Internally
146
-
147
- ### queueRoot()
148
- Loads all Redis configurations based on environment variables, applies TLS if present, and sets reconnection strategies.
149
-
150
- ### QueueModule.forRoot()
151
- Creates dynamic providers for each Redis connection:
152
- ```
153
- RedisQueue_queues1
154
- RedisQueue_queues2
155
- ```
156
-
157
- These providers are available through:
158
- ```ts
159
- @InjectQueue('queues1')
160
- @InjectQueue('queues2')
161
- ```
162
-
163
- ---
164
-
165
105
  ## 📜 License
166
-
167
- MIT - free for commercial and private use.
106
+ MIT - free for commercial and private use.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nestjs-power-queues",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "High-performance Redis Streams queue integration for NestJS based on power-queues.",
5
5
  "author": "ihor-bielchenko",
6
6
  "license": "MIT",
@@ -88,7 +88,7 @@
88
88
  "@nestjs-labs/nestjs-ioredis": "^11.0.4",
89
89
  "@nestjs/common": "^11.1.8",
90
90
  "full-utils": "^2.0.5",
91
- "nestjs-power-redis": "^1.0.9",
92
- "power-queues": "^2.0.17"
91
+ "nestjs-power-redis": "^1.0.12",
92
+ "power-queues": "^2.0.20"
93
93
  }
94
94
  }