@nestjstools/messaging 4.1.0-beta.0 → 4.1.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/README.md +121 -168
- package/lib/bus/in-memory-message.bus.js +2 -2
- package/lib/bus/in-memory-message.bus.js.map +1 -1
- package/lib/config.js.map +1 -1
- package/lib/consumer/consumer-message.d.ts +2 -2
- package/lib/consumer/consumer-message.js.map +1 -1
- package/lib/dependency-injection/decorator.js.map +1 -1
- package/lib/handler/message-handler.registry.js.map +1 -1
- package/lib/messaging.module.js.map +1 -1
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -4,21 +4,30 @@
|
|
|
4
4
|
|
|
5
5
|
# NestJS Messaging Library - Message Bus & Service Bus for Distributed Systems
|
|
6
6
|
|
|
7
|
-
A NestJS library for managing asynchronous and synchronous messages (service bus) with support for buses, handlers,
|
|
7
|
+
A NestJS library for managing asynchronous and synchronous messages (service bus) with support for buses, handlers,
|
|
8
|
+
channels, and consumers. This library simplifies building scalable and decoupled applications by facilitating robust
|
|
9
|
+
message handling pipelines while ensuring flexibility and reliability.
|
|
8
10
|
|
|
9
11
|
---
|
|
10
12
|
|
|
11
13
|
## Features
|
|
14
|
+
|
|
12
15
|
- **Message Buses**: Define multiple buses for commands, events, and queries to streamline message routing.
|
|
13
16
|
- **Handlers**: Easily register and manage handlers for processing messages.
|
|
14
|
-
- **Channels**: Support for in-memory channels and **easy extension** to create custom channel implementations tailored
|
|
15
|
-
|
|
16
|
-
- **
|
|
17
|
+
- **Channels**: Support for in-memory channels and **easy extension** to create custom channel implementations tailored
|
|
18
|
+
to your needs.
|
|
19
|
+
- **Consumers**: Run message consumers to process queued messages asynchronously, ensuring system reliability and fault
|
|
20
|
+
tolerance.
|
|
21
|
+
- **Middleware Support**: Add custom middleware for message transformation such like validation, logging - do whatever
|
|
22
|
+
you want.
|
|
17
23
|
- **Debug Mode**: Enable enhanced logging and debugging capabilities for development.
|
|
18
|
-
- **Extensibility**: Creating new channels is straightforward, allowing developers to expand and integrate with external
|
|
19
|
-
|
|
24
|
+
- **Extensibility**: Creating new channels is straightforward, allowing developers to expand and integrate with external
|
|
25
|
+
systems or protocols effortlessly.
|
|
26
|
+
- **Concurrent Handler Execution**: Messages dispatched to multiple handlers are processed concurrently, improving
|
|
27
|
+
performance and responsiveness across your system.
|
|
20
28
|
|
|
21
29
|
## Channels
|
|
30
|
+
|
|
22
31
|
- [Redis channel adapter](https://www.npmjs.com/package/@nestjstools/messaging-redis-extension)
|
|
23
32
|
- [RabbitMQ channel adapter](https://www.npmjs.com/package/@nestjstools/messaging-rabbitmq-extension)
|
|
24
33
|
- [Amazon SQS channel adapter](https://www.npmjs.com/package/@nestjstools/messaging-amazon-sqs-extension)
|
|
@@ -30,14 +39,9 @@ A NestJS library for managing asynchronous and synchronous messages (service bus
|
|
|
30
39
|
|
|
31
40
|
## Documentation
|
|
32
41
|
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## Example project based on RaabitMQ example
|
|
39
|
-
|
|
40
|
-
Repository: https://github.com/nestjstools/messaging-rabbitmq-example
|
|
42
|
+
- Documentation: https://docs.nestjstools.com/messaging
|
|
43
|
+
- Website: https://nestjstools.com
|
|
44
|
+
- Example repository: https://github.com/nestjstools/messaging-rabbitmq-example
|
|
41
45
|
|
|
42
46
|
---
|
|
43
47
|
|
|
@@ -81,7 +85,8 @@ import { SendMessageHandler } from './handlers/send-message.handler';
|
|
|
81
85
|
}),
|
|
82
86
|
],
|
|
83
87
|
})
|
|
84
|
-
export class AppModule {
|
|
88
|
+
export class AppModule {
|
|
89
|
+
}
|
|
85
90
|
```
|
|
86
91
|
|
|
87
92
|
### Define a Message & Message Handler
|
|
@@ -89,6 +94,7 @@ export class AppModule {}
|
|
|
89
94
|
Create a new handler that processes specific message
|
|
90
95
|
|
|
91
96
|
#### Define your message
|
|
97
|
+
|
|
92
98
|
```typescript
|
|
93
99
|
export class SendMessage {
|
|
94
100
|
constructor(
|
|
@@ -98,7 +104,9 @@ export class SendMessage {
|
|
|
98
104
|
}
|
|
99
105
|
|
|
100
106
|
```
|
|
107
|
+
|
|
101
108
|
#### Define your message handler
|
|
109
|
+
|
|
102
110
|
```typescript
|
|
103
111
|
import { SendMessage } from './send-message';
|
|
104
112
|
import { MessageResponse, MessageHandler, IMessageHandler } from '@nestjstools/messaging';
|
|
@@ -108,9 +116,9 @@ import { Injectable } from '@nestjs/common';
|
|
|
108
116
|
@Injectable()
|
|
109
117
|
@MessageHandler('your.message')
|
|
110
118
|
export class SendMessageHandler implements IMessageHandler<SendMessage> {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
119
|
+
// If you want to receive the message as a properly typed instance (not just a raw object),
|
|
120
|
+
// use the `@DenormalizeMessage()` decorator on the parameter:
|
|
121
|
+
// async handle(@DenormalizeMessage() message: SendMessage): Promise<MessageResponse | void> {
|
|
114
122
|
|
|
115
123
|
async handle(message: SendMessage): Promise<object | void> {
|
|
116
124
|
console.log(message.content);
|
|
@@ -121,7 +129,8 @@ export class SendMessageHandler implements IMessageHandler<SendMessage> {
|
|
|
121
129
|
|
|
122
130
|
### Next Step: Dispatching a Message
|
|
123
131
|
|
|
124
|
-
Messages can be dispatched from anywhere in your application—whether from services, controllers, or other components.
|
|
132
|
+
Messages can be dispatched from anywhere in your application—whether from services, controllers, or other components.
|
|
133
|
+
Here’s an example using an HTTP endpoint:
|
|
125
134
|
|
|
126
135
|
```typescript
|
|
127
136
|
import { Controller, Get } from '@nestjs/common';
|
|
@@ -132,7 +141,8 @@ import { SendMessage } from './test/send-message';
|
|
|
132
141
|
@Controller()
|
|
133
142
|
export class AppController {
|
|
134
143
|
//You can inject every bus which you defined in configuration
|
|
135
|
-
constructor(@MessageBus('message.bus') private readonly messageBus: IMessageBus) {
|
|
144
|
+
constructor(@MessageBus('message.bus') private readonly messageBus: IMessageBus) {
|
|
145
|
+
}
|
|
136
146
|
|
|
137
147
|
@Get()
|
|
138
148
|
async dispatchMessage(): Promise<string> {
|
|
@@ -149,28 +159,39 @@ export class AppController {
|
|
|
149
159
|
### Flow:
|
|
150
160
|
|
|
151
161
|
1. **Flexible Dispatching**:
|
|
152
|
-
- You can call the `dispatch` method from any layer (e.g., controller, service, or scheduled job). This example uses
|
|
162
|
+
- You can call the `dispatch` method from any layer (e.g., controller, service, or scheduled job). This example uses
|
|
163
|
+
an HTTP `GET` endpoint for demonstration.
|
|
153
164
|
|
|
154
165
|
2. **`@MessageBus` Decorator**:
|
|
155
166
|
- Injects the particular message bus (identified by its name, `message.bus`) into the `AppController`.
|
|
156
167
|
|
|
157
168
|
3. **Routing and Payload**:
|
|
158
|
-
- Wrap the payload (`SendMessage`) in a `RoutingMessage` to specify its route (`your.message`), which ensures the
|
|
159
|
-
|
|
169
|
+
- Wrap the payload (`SendMessage`) in a `RoutingMessage` to specify its route (`your.message`), which ensures the
|
|
170
|
+
message is handled by the appropriate handler.
|
|
171
|
+
|
|
160
172
|
4. **HTTP Trigger**:
|
|
161
|
-
- This implementation illustrates an entry point triggered via an HTTP request, showcasing how simple it is to
|
|
173
|
+
- This implementation illustrates an entry point triggered via an HTTP request, showcasing how simple it is to
|
|
174
|
+
connect the messaging system to a web interface.
|
|
162
175
|
|
|
163
176
|
### ⚠️ Warning!
|
|
164
|
-
🚨 Important Notice: You can **return responses from handlers**, but currently, it only works with the `InMemoryChannel`. This behavior may not function as expected if multiple handlers are processing a single message.
|
|
165
177
|
|
|
166
|
-
|
|
178
|
+
🚨 Important Notice: You can **return responses from handlers**, but currently, it only works with the `InMemoryChannel`.
|
|
179
|
+
This behavior may not function as expected if multiple handlers are processing a single message.
|
|
180
|
+
|
|
181
|
+
🛠️ Please ensure you're using a compatible setup when working with multiple handlers, as this could result in unexpected
|
|
182
|
+
behavior.
|
|
167
183
|
|
|
168
184
|
---
|
|
185
|
+
|
|
169
186
|
## Normalizers
|
|
187
|
+
|
|
170
188
|
What is a Normalizer?
|
|
171
|
-
A Normalizer is a component that transforms messages between different formats. It ensures that messages are correctly
|
|
189
|
+
A Normalizer is a component that transforms messages between different formats. It ensures that messages are correctly
|
|
190
|
+
encoded when sent and properly decoded when received. This is particularly useful in messaging systems where messages
|
|
191
|
+
need to be serialized and deserialized efficiently.
|
|
172
192
|
|
|
173
193
|
You can use it to make it works with:
|
|
194
|
+
|
|
174
195
|
* [protobuf](https://protobuf.dev/)
|
|
175
196
|
* Custom JSONs
|
|
176
197
|
* Base64
|
|
@@ -198,10 +219,15 @@ export class Base64Normalizer implements MessageNormalizer {
|
|
|
198
219
|
}
|
|
199
220
|
|
|
200
221
|
```
|
|
222
|
+
|
|
201
223
|
### How It Works
|
|
224
|
+
|
|
202
225
|
#### Normalization (normalize)
|
|
226
|
+
|
|
203
227
|
* Converts a JSON object to a Base64 string before sending.
|
|
228
|
+
|
|
204
229
|
#### Denormalization (denormalize)
|
|
230
|
+
|
|
205
231
|
* Decodes the Base64 string back into a JSON object after receiving.
|
|
206
232
|
|
|
207
233
|
You can define a **Normalizer** per Channel
|
|
@@ -209,15 +235,20 @@ ___
|
|
|
209
235
|
|
|
210
236
|
## ⤵️ Middlewares
|
|
211
237
|
|
|
212
|
-
A **middleware** in the context of the `MessagingModule` is a function that processes messages as they pass through the
|
|
238
|
+
A **middleware** in the context of the `MessagingModule` is a function that processes messages as they pass through the
|
|
239
|
+
message pipeline. The middleware can intercept, modify, or log messages before they are handled by the respective *
|
|
240
|
+
*message handler**. This is particularly useful for logging, authentication, validation, or any other pre-processing
|
|
241
|
+
step before the actual business logic is applied.
|
|
213
242
|
|
|
214
|
-
Each **channel** in the messaging system has its own set of middlewares, and these middlewares are executed in order
|
|
243
|
+
Each **channel** in the messaging system has its own set of middlewares, and these middlewares are executed in order
|
|
244
|
+
when a message is dispatched through the respective channel.
|
|
215
245
|
|
|
216
246
|
### How to Use Middleware in Messaging Channels:
|
|
217
247
|
|
|
218
248
|
To use middleware, you need to:
|
|
219
249
|
|
|
220
|
-
1. **Define the middleware class** that implements the `Middleware` interface, which contains the `process` method that
|
|
250
|
+
1. **Define the middleware class** that implements the `Middleware` interface, which contains the `process` method that
|
|
251
|
+
processes the message.
|
|
221
252
|
2. **Attach the middleware to a specific channel** via the channel configuration.
|
|
222
253
|
|
|
223
254
|
### Example Middleware Code:
|
|
@@ -231,17 +262,18 @@ import { Middleware, RoutingMessage } from '@nestjstools/messaging';
|
|
|
231
262
|
@Injectable()
|
|
232
263
|
@MessagingMiddleware()
|
|
233
264
|
export class TestMiddleware implements Middleware {
|
|
234
|
-
|
|
235
|
-
|
|
265
|
+
async process(message: RoutingMessage, context: MiddlewareContext): Promise<MiddlewareContext> {
|
|
266
|
+
console.log('!!!! WORKS'); // Log or process the message here
|
|
236
267
|
|
|
237
|
-
|
|
238
|
-
|
|
268
|
+
return await context.next().process(message, context); //TODO call `next()` method from `MiddlewareContext` to process next middleware
|
|
269
|
+
}
|
|
239
270
|
}
|
|
240
271
|
```
|
|
241
272
|
|
|
242
273
|
### Attaching Middleware to a Channel:
|
|
243
274
|
|
|
244
|
-
Now that we've defined the middleware, it needs to be attached to a specific channel in the `MessagingModule`
|
|
275
|
+
Now that we've defined the middleware, it needs to be attached to a specific channel in the `MessagingModule`
|
|
276
|
+
configuration. Here's how you would configure the middleware for a channel:
|
|
245
277
|
|
|
246
278
|
```typescript
|
|
247
279
|
import { MessagingModule, AmqpChannelConfig, InMemoryChannelConfig } from '@nestjstools/messaging';
|
|
@@ -278,48 +310,60 @@ import { SendMessageHandler } from './handlers/send-message.handler';
|
|
|
278
310
|
}),
|
|
279
311
|
],
|
|
280
312
|
})
|
|
281
|
-
export class AppModule {
|
|
313
|
+
export class AppModule {
|
|
314
|
+
}
|
|
282
315
|
```
|
|
283
316
|
|
|
284
317
|
### Explanation of How It Works:
|
|
285
318
|
|
|
286
319
|
1. **Middleware Class**:
|
|
287
|
-
- A `Middleware` is a class that implements the `next` method. In this case, the `TestMiddleware` simply logs
|
|
320
|
+
- A `Middleware` is a class that implements the `next` method. In this case, the `TestMiddleware` simply logs
|
|
321
|
+
`'!!!! WORKS'` and allows the message to continue.
|
|
288
322
|
|
|
289
323
|
2. **Message Pipeline**:
|
|
290
324
|
- When a message is dispatched, it passes through the series of middlewares configured for its channel.
|
|
291
|
-
- The middlewares execute in the order they're listed for the channel, and each `next` method decides what happens
|
|
325
|
+
- The middlewares execute in the order they're listed for the channel, and each `next` method decides what happens
|
|
326
|
+
to the message—whether it continues or gets transformed.
|
|
292
327
|
|
|
293
328
|
3. **Channel-Specific Middlewares**:
|
|
294
|
-
- Each channel can have its own set of middlewares defined in the channel's configuration (e.g.,
|
|
295
|
-
|
|
329
|
+
- Each channel can have its own set of middlewares defined in the channel's configuration (e.g.,
|
|
330
|
+
`InMemoryChannelConfig` and `AmqpChannelConfig`).
|
|
331
|
+
- This allows flexible control of how messages are processed depending on the channel, enabling different logic for
|
|
332
|
+
each transport mechanism (in-memory vs. RabbitMQ).
|
|
296
333
|
|
|
297
334
|
### Benefits of Using Middlewares:
|
|
298
|
-
|
|
335
|
+
|
|
336
|
+
- **Separation of Concerns**: Middlewares help encapsulate cross-cutting concerns like logging, validation, and
|
|
337
|
+
authentication, making the code cleaner.
|
|
299
338
|
- **Reusability**: A middleware can be reused across different channels to perform the same actions on various messages.
|
|
300
|
-
- **Custom Logic**: You can apply custom transformations, logging, or other types of business logic to messages as they
|
|
339
|
+
- **Custom Logic**: You can apply custom transformations, logging, or other types of business logic to messages as they
|
|
340
|
+
move through the pipeline.
|
|
301
341
|
|
|
302
342
|
---
|
|
303
343
|
|
|
304
344
|
## 🔰 ExceptionListener
|
|
305
345
|
|
|
306
|
-
The **ExceptionListener** provides a centralized way to handle exceptions thrown during asynchronous message processing
|
|
346
|
+
The **ExceptionListener** provides a centralized way to handle exceptions thrown during asynchronous message processing
|
|
347
|
+
from any **channel** in your **messaging system**.
|
|
307
348
|
|
|
308
|
-
By decorating a class with `@MessagingExceptionListener()` and implementing the `ExceptionListener` interface, you can
|
|
349
|
+
By decorating a class with `@MessagingExceptionListener()` and implementing the `ExceptionListener` interface, you can
|
|
350
|
+
intercept and respond to any unhandled exception occurring during message handling — whether it's logging, reporting,
|
|
351
|
+
retries, or custom recovery logic.
|
|
309
352
|
|
|
310
353
|
Example Use Case:
|
|
311
354
|
You can log the error, send a notification, or trigger fallback logic whenever a message handler throws an exception.
|
|
312
355
|
|
|
313
356
|
### Example ExceptionListener Code:
|
|
357
|
+
|
|
314
358
|
```typescript
|
|
315
359
|
import { Injectable } from '@nestjs/common';
|
|
316
360
|
import { ExceptionListener, MessagingExceptionListener, ExceptionContext } from '@nestjstools/messaging';
|
|
317
361
|
|
|
318
362
|
@MessagingExceptionListener()
|
|
319
363
|
export class CustomExceptionListener implements ExceptionListener {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
364
|
+
onException(context: ExceptionContext): Promise<void> {
|
|
365
|
+
console.log(`Here I can handle exception If I want and do some action`);
|
|
366
|
+
}
|
|
323
367
|
}
|
|
324
368
|
```
|
|
325
369
|
|
|
@@ -335,45 +379,55 @@ A custom logger must implement the interface `MessagingLogger` interface:
|
|
|
335
379
|
### Providing a custom logger
|
|
336
380
|
|
|
337
381
|
When configuring the **messaging module**, you can pass your own logger instance via options `customLogger`.
|
|
382
|
+
|
|
338
383
|
```ts
|
|
384
|
+
|
|
339
385
|
@Module({
|
|
340
386
|
imports: [
|
|
341
387
|
MessagingModule.forRoot({
|
|
342
388
|
customLogger: new MyCustomLogger(),
|
|
343
|
-
|
|
389
|
+
...
|
|
344
390
|
}),
|
|
345
391
|
],
|
|
346
392
|
})
|
|
347
|
-
export class AppModule {
|
|
393
|
+
export class AppModule {
|
|
394
|
+
}
|
|
348
395
|
```
|
|
396
|
+
|
|
349
397
|
or if you defined it as provider
|
|
398
|
+
|
|
350
399
|
```ts
|
|
400
|
+
|
|
351
401
|
@Module({
|
|
352
402
|
imports: [
|
|
353
403
|
MessagingModule.forRoot({
|
|
354
404
|
customLogger: MyCustomLogger,
|
|
355
|
-
|
|
405
|
+
...
|
|
356
406
|
}),
|
|
357
407
|
],
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
408
|
+
providers: [
|
|
409
|
+
MyCustomLogger,
|
|
410
|
+
],
|
|
361
411
|
})
|
|
362
|
-
export class AppModule {
|
|
412
|
+
export class AppModule {
|
|
413
|
+
}
|
|
363
414
|
```
|
|
364
415
|
|
|
365
416
|
## Configuration options
|
|
366
417
|
|
|
367
418
|
### `MessagingModule.forRoot` Configuration
|
|
419
|
+
|
|
368
420
|
<br>
|
|
369
421
|
|
|
370
|
-
| **Property**
|
|
371
|
-
|
|
372
|
-
| **`buses`**
|
|
373
|
-
| **`channels`**
|
|
374
|
-
| **`debug`**
|
|
375
|
-
| **`logging`**
|
|
376
|
-
| **`customLogger`**
|
|
422
|
+
| **Property** | **Description** | **Default Value** |
|
|
423
|
+
|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|
|
|
424
|
+
| **`buses`** | Array of message buses that define routing and processing of messages. | `[]` (empty array by default) |
|
|
425
|
+
| **`channels`** | Array of channel configurations used by the message buses. | `[]` (empty array by default) |
|
|
426
|
+
| **`debug`** | Enables or disables debug mode for logging additional messages. | `false` |
|
|
427
|
+
| **`logging`** | Enables or disables logging for bus activity (e.g., message dispatch). | `true` |
|
|
428
|
+
| **`customLogger`** | Instance of a class implements `MessagingLogger` for custom logging integration. | `NestLogger` |
|
|
429
|
+
| **`forceDisableAllConsumers`** | Forces all messaging consumers to be disabled. Messages can only be processed through the `InMemoryChannel`. Useful in testing environments to prevent external transports or background consumers from running. | `false` |
|
|
430
|
+
|
|
377
431
|
---
|
|
378
432
|
|
|
379
433
|
### Buses
|
|
@@ -389,111 +443,10 @@ export class AppModule {}
|
|
|
389
443
|
|
|
390
444
|
#### **InMemoryChannelConfig**
|
|
391
445
|
|
|
392
|
-
| **Property** | **Description**
|
|
393
|
-
|
|
394
|
-
| **`name`** | Name of the in-memory channel (e.g., `'my-channel'`).
|
|
395
|
-
| **`middlewares`** | List of middlewares to apply to the channel.
|
|
396
|
-
| **`avoidErrorsForNotExistedHandlers`** | Avoid errors if no handler is available for the message.
|
|
397
|
-
| **`normalizer`** | Set your custom normalizer for messages
|
|
398
|
-
|
|
399
|
-
## Creating Your Own Channel and Bus
|
|
400
|
-
This process allows you to define and integrate a custom **Channel** and **MessageBus** for your application, giving you complete flexibility and control over how messages are processed, dispatched, and consumed. Each step provides the necessary building blocks to create your own transport layer with full integration into the `MessagingModule`.
|
|
401
|
-
|
|
402
|
-
### 1. Create a `ChannelConfig`
|
|
403
|
-
A `ChannelConfig` class holds the configuration required to establish a stable connection to your service (e.g., RabbitMQ, Redis, etc.). Your class should implement the `ChannelConfig` interface and define necessary data like the channel name and middlewares.
|
|
404
|
-
|
|
405
|
-
```typescript
|
|
406
|
-
export class YourChannelConfig implements ChannelConfig {
|
|
407
|
-
public readonly name: string;
|
|
408
|
-
public readonly middlewares: object[];
|
|
409
|
-
|
|
410
|
-
constructor({ name, middlewares }: AmqpChannelConfig) {
|
|
411
|
-
this.name = name;
|
|
412
|
-
this.middlewares = middlewares ?? []; // Default to empty array if no middlewares provided
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
### 2. Create a `Channel`
|
|
418
|
-
Next, create a class that implements the `Channel` interface. This class will serve as your `DataSource` and utilize the configuration you defined in the `ChannelConfig` class.
|
|
419
|
-
|
|
420
|
-
```typescript
|
|
421
|
-
export class YourChannel extends Channel {}
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
### 3. Create a `ChannelFactory`
|
|
425
|
-
A `ChannelFactory` is responsible for creating instances of your custom `Channel` class. It implements the `IChannelFactory` interface and ensures proper injection into your app.
|
|
426
|
-
|
|
427
|
-
```typescript
|
|
428
|
-
@Injectable()
|
|
429
|
-
@ChannelFactory(YourChannel)
|
|
430
|
-
export class YourChannelFactory implements IChannelFactory<YourChannelConfig> {
|
|
431
|
-
create(channelConfig: YourChannelConfig): Channel {
|
|
432
|
-
return new YourChannel(channelConfig);
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
### 4. Create a `MessageBus`
|
|
438
|
-
The `MessageBus` handles the dispatching of messages in your system. Create a class implementing the `IMessageBus` interface to send messages to your custom service (e.g., RabbitMQ, Redis, etc.).
|
|
439
|
-
|
|
440
|
-
```typescript
|
|
441
|
-
export class YourMessageBus implements IMessageBus {
|
|
442
|
-
constructor(private readonly yourChannel: YourChannel) {}
|
|
443
|
-
|
|
444
|
-
async dispatch(message: RoutingMessage): Promise<MessageResponse | void> {
|
|
445
|
-
// Write your logic here to dispatch the message to your channel (e.g., RabbitMQ)
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
### 5. Create a `MessageBusFactory`
|
|
451
|
-
The `MessageBusFactory` creates instances of your `MessageBus` and ensures it's properly integrated with your `Channel`. It implements the `IMessageBusFactory` interface.
|
|
452
|
-
|
|
453
|
-
```typescript
|
|
454
|
-
@Injectable()
|
|
455
|
-
@MessageBusFactory(YourChannel)
|
|
456
|
-
export class YourMessageBusFactory implements IMessageBusFactory<YourChannel> {
|
|
457
|
-
create(channel: YourChannel): IMessageBus {
|
|
458
|
-
return new YourMessageBus(channel); // Return a new instance of your message bus
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
### 6. Create a Consumer `MessageConsumer`
|
|
464
|
-
A consumer receives and processes messages. Create a class that implements the `IMessagingConsumer` interface and handle the message processing within the `consume` method.
|
|
465
|
-
|
|
466
|
-
```typescript
|
|
467
|
-
@Injectable()
|
|
468
|
-
@MessageConsumer(YourChannel)
|
|
469
|
-
export class YourMessagingConsumer implements IMessagingConsumer<YourChannel> {
|
|
470
|
-
async consume(dispatcher: ConsumerMessageDispatcher, channel: YourChannel): Promise<void> {
|
|
471
|
-
// Logic to consume a message...
|
|
472
|
-
//TODO dispatcher.dispatch(new ConsumerMessage(...));
|
|
473
|
-
|
|
474
|
-
return Promise.resolve();
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
async onError(errored: ConsumerDispatchedMessageError, channel: YourChannel): Promise<void> {
|
|
478
|
-
// Handle error if message processing fails
|
|
479
|
-
return Promise.resolve();
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
### 7. Add Custom `MessageOptions` to Your Bus (Optional)
|
|
485
|
-
You can create custom message options for your message.
|
|
486
|
-
|
|
487
|
-
```typescript
|
|
488
|
-
export class YourMessageOptions implements MessageOptions {
|
|
489
|
-
constructor(public readonly middlewares: Middleware[] = []) {}
|
|
490
|
-
}
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
Classes with `Injectable()` decorator must be defined as providers in somewhere in application.
|
|
494
|
-
|
|
495
|
-
---
|
|
496
|
-
## Keywords
|
|
446
|
+
| **Property** | **Description** | **Default Value** |
|
|
447
|
+
|----------------------------------------|----------------------------------------------------------|-------------------|
|
|
448
|
+
| **`name`** | Name of the in-memory channel (e.g., `'my-channel'`). | |
|
|
449
|
+
| **`middlewares`** | List of middlewares to apply to the channel. | `[]` |
|
|
450
|
+
| **`avoidErrorsForNotExistedHandlers`** | Avoid errors if no handler is available for the message. | `false` |
|
|
451
|
+
| **`normalizer`** | Set your custom normalizer for messages | |
|
|
497
452
|
|
|
498
|
-
nestjs messaging library, nestjs message bus, nestjs service bus, <br>nestjs distributed systems,
|
|
499
|
-
nestjs microservices messaging, broker independent messaging for nestjs
|
|
@@ -45,9 +45,9 @@ class InMemoryMessageBus {
|
|
|
45
45
|
const context = middleware_context_1.MiddlewareContext.createFresh(middlewareInstances);
|
|
46
46
|
let messageToDispatch = message instanceof routing_message_1.RoutingMessage ? message.message : {};
|
|
47
47
|
if (message instanceof sealed_routing_message_1.SealedRoutingMessage) {
|
|
48
|
-
|
|
48
|
+
const normalizerDefinition = message.messageOptions instanceof default_message_options_1.DefaultMessageOptions
|
|
49
49
|
? message.messageOptions.normalizer
|
|
50
|
-
: object_forward_message_normalizer_1.ObjectForwardMessageNormalizer
|
|
50
|
+
: object_forward_message_normalizer_1.ObjectForwardMessageNormalizer;
|
|
51
51
|
messageToDispatch = await this.normalizerRegistry
|
|
52
52
|
.getByName(normalizerDefinition['name'])
|
|
53
53
|
.denormalize(message.message, message.messageRoutingKey);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory-message.bus.js","sourceRoot":"","sources":["../../src/bus/in-memory-message.bus.ts"],"names":[],"mappings":";;;AAGA,oEAA+D;AAC/D,yEAAqE;AACrE,yEAAqE;AACrE,uEAAmE;AAEnE,8EAAyE;AACzE,uGAAiG;AACjG,gEAA4D;AAE5D,gEAA4D;AAE5D,gFAA2E;AAE3E,MAAa,kBAAkB;IAC7B,YACU,QAAgC,EAChC,kBAAsC,EACtC,OAAwB,EACxB,kBAAsC;QAHtC,aAAQ,GAAR,QAAQ,CAAwB;QAChC,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,YAAO,GAAP,OAAO,CAAiB;QACxB,uBAAkB,GAAlB,kBAAkB,CAAoB;IAC7C,CAAC;IAEJ,KAAK,CAAC,QAAQ,CAAC,OAAgB;QAC7B,MAAM,WAAW,GAAG,EAAE,CAAC;QACvB,WAAW,CAAC,IAAI,CACd,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,IAAI,EAAE,CAAC,EAC3C,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,WAAW,IAAI,EAAE,CAAC,EAC9C,sCAAiB,CAClB,CAAC;QAEF,IAAI,CAAC;YACH,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,gCAAgC,GAAG,IA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;CACF;AAvCD,sCAuCC;AAED,MAAa,qBAAsB,SAAQ,aAAa;IACtD,YAAY,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAAA,sGAAgG;AAoChG,MAAa,aAAa;IA0BxB,YACkB,IAAY,EAC5B,gCAA0C,EAC1C,WAAsB,EACtB,cAAwB,EACxB,UAAmB;QAJH,SAAI,GAAJ,IAAI,CAAQ;QAM5B,IAAI,CAAC,gCAAgC;YACnC,gCAAgC,IAAI,KAAK,CAAC;QAC5C,IAAI,CAAC,WAAW,GAAG,WAAW,IAAI,EAAE,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,cAAc,IAAI,IAAI,CAAC;QAC7C,IAAI,CAAC,UAAU,GAAG,UAAU,IAAI,kEAA8B,CAAC;IACjE,CAAC;CACF;AAvCD,sCAuCC;AAED,MAAa,qBAAsB,SAAQ,aAAa;IACtD,YAAY,EACV,IAAI,EACJ,gCAAgC,EAChC,WAAW,EACX,cAAc,EACd,UAAU,GACY;QACtB,KAAK,CACH,IAAI,EACJ,gCAAgC,EAChC,WAAW,EACX,cAAc,EACd,UAAU,CACX,CAAC;IACJ,CAAC;CACF;AAhBD,sDAgBC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare class ConsumerMessage {
|
|
2
2
|
readonly message: object | string;
|
|
3
3
|
readonly routingKey: string;
|
|
4
|
-
readonly metadata:
|
|
5
|
-
constructor(message: object | string, routingKey: string, metadata?:
|
|
4
|
+
readonly metadata: Record<string, any>;
|
|
5
|
+
constructor(message: object | string, routingKey: string, metadata?: Record<string, any>);
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consumer-message.js","sourceRoot":"","sources":["../../src/consumer/consumer-message.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;IAC1B,YACkB,OAAwB,EACxB,UAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"consumer-message.js","sourceRoot":"","sources":["../../src/consumer/consumer-message.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;IAC1B,YACkB,OAAwB,EACxB,UAAkB,EAClB,WAAgC,EAAE;QAFlC,YAAO,GAAP,OAAO,CAAiB;QACxB,eAAU,GAAV,UAAU,CAAQ;QAClB,aAAQ,GAAR,QAAQ,CAA0B;QAElD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AATD,0CASC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../src/dependency-injection/decorator.ts"],"names":[],"mappings":";;;AAwEA,gDAUC;AAhFY,QAAA,wBAAwB,GAAG,0BAA0B,CAAC;AACtD,QAAA,wBAAwB,GAAG,0BAA0B,CAAC;AACtD,QAAA,4BAA4B,GAAG,8BAA8B,CAAC;AAC9D,QAAA,yBAAyB,GAAG,2BAA2B,CAAC;AACxD,QAAA,6BAA6B,GAAG,+BAA+B,CAAC;AAChE,QAAA,6BAA6B,GAAG,+BAA+B,CAAC;AAChE,QAAA,qCAAqC,GAChD,uCAAuC,CAAC;AAC7B,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AAEhE,MAAM,cAAc,GAAG,CAAC,GAAG,UAAoB,EAAkB,EAAE;IACxE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../src/dependency-injection/decorator.ts"],"names":[],"mappings":";;;AAwEA,gDAUC;AAhFY,QAAA,wBAAwB,GAAG,0BAA0B,CAAC;AACtD,QAAA,wBAAwB,GAAG,0BAA0B,CAAC;AACtD,QAAA,4BAA4B,GAAG,8BAA8B,CAAC;AAC9D,QAAA,yBAAyB,GAAG,2BAA2B,CAAC;AACxD,QAAA,6BAA6B,GAAG,+BAA+B,CAAC;AAChE,QAAA,6BAA6B,GAAG,+BAA+B,CAAC;AAChE,QAAA,qCAAqC,G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ry.ts"],"names":[],"mappings":";;;AACA,kHAA0G;AAE1G,MAAa,sBAAsB;IAAnC;QACU,aAAQ,GAAwC,IAAI,GAAG,EAAE,CAAC;IA+BpE,CAAC;IA7BC,QAAQ,CAAC,KAAe,EAAE,OAA6B;QACrD,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,cAAc,CAAC,IAAY,EAAE,OAA6B;QAChE,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"message-handler.registry.js","sourceRoot":"","sources":["../../src/handler/message-handler.registry.ts"],"names":[],"mappings":";;;AACA,kHAA0G;AAE1G,MAAa,sBAAsB;IAAnC;QACU,aAAQ,GAAwC,IAAI,GAAG,EAAE,CAAC;IA+BpE,CAAC;IA7BC,QAAQ,CAAC,KAAe,EAAE,OAA6B;QACrD,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,cAAc,CAAC,IAAY,EAAE,OAA6B;QAChE,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAEvC,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC7B,OAAO;YACT,CAAC;YAED,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEtC,OAAO;QACT,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,eAAe,CAAC,UAAkB;QAChC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,4EAAkC,CAAC,UAAU,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;CACF;AAhCD,wDAgCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messaging.module.js","sourceRoot":"","sources":["../src/messaging.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"messaging.module.js","sourceRoot":"","sources":["../src/messaging.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CASwB;AACxB,qCAOkB;AAClB,4DAAyD;AACzD,2FAAsF;AACtF,iEAA6D;AAC7D,uFAAiF;AACjF,2EAAsE;AACtE,uCAA4E;AAC5E,uEAAiE;AACjE,iFAA4E;AAE5E,sDAAkD;AAClD,2FAAqF;AACrF,0EAAsE;AACtE,8DAKyC;AACzC,0EAAsE;AACtE,uFAAgF;AAChF,mEAA8D;AAC9D,wEAAoE;AACpE,yEAAoE;AACpE,0EAAsE;AACtE,sGAAgG;AAChG,kGAA6F;AAC7F,gGAA2F;AAIpF,IAAM,eAAe,uBAArB,MAAM,eAAe;IAG1B,MAAM,CAAC,OAAO,CAAC,OAA+B;QAC5C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;QAExC,MAAM,gBAAgB,GAAoB;YACxC,OAAO,EAAE,iBAAO,CAAC,QAAQ;YACzB,UAAU,EAAE,CAAC,uBAAgD,EAAE,EAAE;gBAC/D,OAAO,QAAQ,CAA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