@bsb/events-rabbitmq 0.0.1 → 9.6.14
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/LICENSE +660 -660
- package/README.md +109 -109
- package/lib/plugins/events-rabbitmq/plugin.config.json +38 -38
- package/lib/schemas/events-rabbitmq.json +1 -1
- package/lib/schemas/events-rabbitmq.plugin.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
# @bsb/events-rabbitmq
|
|
2
|
-
|
|
3
|
-
RabbitMQ events plugin for BSB that provides a distributed event bus using AMQP. It enables communication between multiple processes, containers, and microservices with reliable delivery and advanced routing.
|
|
4
|
-
|
|
5
|
-
## Key Features
|
|
6
|
-
|
|
7
|
-
- Distributed event bus across multiple processes and containers
|
|
8
|
-
- Full support for all BSB event patterns (fire-and-forget, request-response, broadcast, streaming)
|
|
9
|
-
- RabbitMQ cluster support with automatic reconnection
|
|
10
|
-
- Reliable message delivery with acknowledgments
|
|
11
|
-
- Configurable prefetch for load balancing
|
|
12
|
-
- Platform isolation with multi-tenancy support
|
|
13
|
-
- Unique client identification for routing
|
|
14
|
-
|
|
15
|
-
## Installation
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install @bsb/events-rabbitmq
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Configuration
|
|
22
|
-
|
|
23
|
-
Add the plugin to your BSB configuration file:
|
|
24
|
-
|
|
25
|
-
```yaml
|
|
26
|
-
plugins:
|
|
27
|
-
events:
|
|
28
|
-
plugin: "@bsb/events-rabbitmq"
|
|
29
|
-
enabled: true
|
|
30
|
-
config:
|
|
31
|
-
endpoints:
|
|
32
|
-
- "amqp://localhost:5672"
|
|
33
|
-
credentials:
|
|
34
|
-
username: "guest"
|
|
35
|
-
password: "guest"
|
|
36
|
-
prefetch: 10
|
|
37
|
-
fatalOnDisconnect: true
|
|
38
|
-
platformKey: null
|
|
39
|
-
uniqueId: null
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Configuration Options
|
|
43
|
-
|
|
44
|
-
| Option | Description | Default |
|
|
45
|
-
|--------|-------------|---------|
|
|
46
|
-
| `endpoints` | Array of RabbitMQ server URLs (cluster support) | `["amqp://localhost"]` |
|
|
47
|
-
| `credentials.username` | RabbitMQ username | `guest` |
|
|
48
|
-
| `credentials.password` | RabbitMQ password | `guest` |
|
|
49
|
-
| `prefetch` | Messages to prefetch per consumer | `10` |
|
|
50
|
-
| `fatalOnDisconnect` | Exit process on connection loss | `true` |
|
|
51
|
-
| `platformKey` | Isolate multiple BSB platforms on same RabbitMQ | `null` |
|
|
52
|
-
| `uniqueId` | Static client ID (uses hostname if not set) | `null` |
|
|
53
|
-
|
|
54
|
-
## Usage
|
|
55
|
-
|
|
56
|
-
Once configured, the plugin provides the same API as `events-default`, but distributed across RabbitMQ.
|
|
57
|
-
|
|
58
|
-
### Fire-and-Forget
|
|
59
|
-
|
|
60
|
-
```typescript
|
|
61
|
-
await this.events.emitEvent("order.created", {
|
|
62
|
-
orderId: "12345",
|
|
63
|
-
items: [{ sku: "ABC", qty: 2 }]
|
|
64
|
-
});
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### Request-Response
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
const result = await this.events.emitEventAndReturn(
|
|
71
|
-
"user.validate",
|
|
72
|
-
{ email: "user@example.com" },
|
|
73
|
-
5000
|
|
74
|
-
);
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Broadcast
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
await this.events.emitBroadcast("cache.invalidate", { keys: ["a", "b"] });
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Streaming
|
|
84
|
-
|
|
85
|
-
```typescript
|
|
86
|
-
const streamId = await this.events.receiveStream("file.upload", handler, 30);
|
|
87
|
-
await this.events.sendStream("file.upload", streamId, fileStream);
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## RabbitMQ Setup
|
|
91
|
-
|
|
92
|
-
For local development, the RabbitMQ management image is a quick start:
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:management
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## Documentation
|
|
99
|
-
|
|
100
|
-
Detailed documentation (used by the BSB Registry): `https://github.com/BetterCorp/better-service-base/blob/master/plugins/nodejs/events-rabbitmq/docs/plugin.md`
|
|
101
|
-
|
|
102
|
-
## Links
|
|
103
|
-
|
|
104
|
-
- GitHub: `https://github.com/BetterCorp/better-service-base/tree/master/plugins/nodejs/events-rabbitmq`
|
|
105
|
-
- BSB Registry (package): `https://io.bsbcode.dev/packages/nodejs/@bsb/events-rabbitmq`
|
|
106
|
-
|
|
107
|
-
## License
|
|
108
|
-
|
|
109
|
-
(AGPL-3.0-only OR Commercial)
|
|
1
|
+
# @bsb/events-rabbitmq
|
|
2
|
+
|
|
3
|
+
RabbitMQ events plugin for BSB that provides a distributed event bus using AMQP. It enables communication between multiple processes, containers, and microservices with reliable delivery and advanced routing.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- Distributed event bus across multiple processes and containers
|
|
8
|
+
- Full support for all BSB event patterns (fire-and-forget, request-response, broadcast, streaming)
|
|
9
|
+
- RabbitMQ cluster support with automatic reconnection
|
|
10
|
+
- Reliable message delivery with acknowledgments
|
|
11
|
+
- Configurable prefetch for load balancing
|
|
12
|
+
- Platform isolation with multi-tenancy support
|
|
13
|
+
- Unique client identification for routing
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @bsb/events-rabbitmq
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Configuration
|
|
22
|
+
|
|
23
|
+
Add the plugin to your BSB configuration file:
|
|
24
|
+
|
|
25
|
+
```yaml
|
|
26
|
+
plugins:
|
|
27
|
+
events:
|
|
28
|
+
plugin: "@bsb/events-rabbitmq"
|
|
29
|
+
enabled: true
|
|
30
|
+
config:
|
|
31
|
+
endpoints:
|
|
32
|
+
- "amqp://localhost:5672"
|
|
33
|
+
credentials:
|
|
34
|
+
username: "guest"
|
|
35
|
+
password: "guest"
|
|
36
|
+
prefetch: 10
|
|
37
|
+
fatalOnDisconnect: true
|
|
38
|
+
platformKey: null
|
|
39
|
+
uniqueId: null
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Configuration Options
|
|
43
|
+
|
|
44
|
+
| Option | Description | Default |
|
|
45
|
+
|--------|-------------|---------|
|
|
46
|
+
| `endpoints` | Array of RabbitMQ server URLs (cluster support) | `["amqp://localhost"]` |
|
|
47
|
+
| `credentials.username` | RabbitMQ username | `guest` |
|
|
48
|
+
| `credentials.password` | RabbitMQ password | `guest` |
|
|
49
|
+
| `prefetch` | Messages to prefetch per consumer | `10` |
|
|
50
|
+
| `fatalOnDisconnect` | Exit process on connection loss | `true` |
|
|
51
|
+
| `platformKey` | Isolate multiple BSB platforms on same RabbitMQ | `null` |
|
|
52
|
+
| `uniqueId` | Static client ID (uses hostname if not set) | `null` |
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
Once configured, the plugin provides the same API as `events-default`, but distributed across RabbitMQ.
|
|
57
|
+
|
|
58
|
+
### Fire-and-Forget
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
await this.events.emitEvent("order.created", {
|
|
62
|
+
orderId: "12345",
|
|
63
|
+
items: [{ sku: "ABC", qty: 2 }]
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Request-Response
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
const result = await this.events.emitEventAndReturn(
|
|
71
|
+
"user.validate",
|
|
72
|
+
{ email: "user@example.com" },
|
|
73
|
+
5000
|
|
74
|
+
);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Broadcast
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
await this.events.emitBroadcast("cache.invalidate", { keys: ["a", "b"] });
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Streaming
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
const streamId = await this.events.receiveStream("file.upload", handler, 30);
|
|
87
|
+
await this.events.sendStream("file.upload", streamId, fileStream);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## RabbitMQ Setup
|
|
91
|
+
|
|
92
|
+
For local development, the RabbitMQ management image is a quick start:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:management
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Documentation
|
|
99
|
+
|
|
100
|
+
Detailed documentation (used by the BSB Registry): `https://github.com/BetterCorp/better-service-base/blob/master/plugins/nodejs/events-rabbitmq/docs/plugin.md`
|
|
101
|
+
|
|
102
|
+
## Links
|
|
103
|
+
|
|
104
|
+
- GitHub: `https://github.com/BetterCorp/better-service-base/tree/master/plugins/nodejs/events-rabbitmq`
|
|
105
|
+
- BSB Registry (package): `https://io.bsbcode.dev/packages/nodejs/@bsb/events-rabbitmq`
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
(AGPL-3.0-only OR Commercial)
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
{
|
|
2
|
-
"key": "events-rabbitmq",
|
|
3
|
-
"name": "RabbitMQ",
|
|
4
|
-
"icon": "events-rabbitmq.png",
|
|
5
|
-
"description": "RabbitMQ events plugin",
|
|
6
|
-
"badges": [
|
|
7
|
-
{
|
|
8
|
-
"url": "https://codecov.io/gh/BetterCorp/service-base-events-rabbitmq",
|
|
9
|
-
"img": "https://codecov.io/gh/BetterCorp/service-base-events-rabbitmq/branch/master/graph/badge.svg"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"img": "https://img.shields.io/github/license/BetterCorp/service-base-events-rabbitmq"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"img": "https://img.shields.io/snyk/vulnerabilities/github/BetterCorp/service-base-events-rabbitmq"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"img": "https://img.shields.io/github/issues-raw/BetterCorp/service-base-events-rabbitmq"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"img": "https://github.com/BetterCorp/service-base-events-rabbitmq/actions/workflows/develop.yml/badge.svg?branch=develop"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"img": "https://github.com/BetterCorp/service-base-events-rabbitmq/actions/workflows/master.yml/badge.svg?branch=master"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"img": "https://img.shields.io/github/issues-raw/BetterCorp/service-base-events-rabbitmq"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"img": "https://img.shields.io/npm/dt/@bettercorp/service-base-events-rabbitmq"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"img": "https://img.shields.io/bundlephobia/min/@bettercorp/service-base-events-rabbitmq"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"img": "https://img.shields.io/npm/v/@bettercorp/service-base-events-rabbitmq"
|
|
37
|
-
}
|
|
38
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"key": "events-rabbitmq",
|
|
3
|
+
"name": "RabbitMQ",
|
|
4
|
+
"icon": "events-rabbitmq.png",
|
|
5
|
+
"description": "RabbitMQ events plugin",
|
|
6
|
+
"badges": [
|
|
7
|
+
{
|
|
8
|
+
"url": "https://codecov.io/gh/BetterCorp/service-base-events-rabbitmq",
|
|
9
|
+
"img": "https://codecov.io/gh/BetterCorp/service-base-events-rabbitmq/branch/master/graph/badge.svg"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"img": "https://img.shields.io/github/license/BetterCorp/service-base-events-rabbitmq"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"img": "https://img.shields.io/snyk/vulnerabilities/github/BetterCorp/service-base-events-rabbitmq"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"img": "https://img.shields.io/github/issues-raw/BetterCorp/service-base-events-rabbitmq"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"img": "https://github.com/BetterCorp/service-base-events-rabbitmq/actions/workflows/develop.yml/badge.svg?branch=develop"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"img": "https://github.com/BetterCorp/service-base-events-rabbitmq/actions/workflows/master.yml/badge.svg?branch=master"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"img": "https://img.shields.io/github/issues-raw/BetterCorp/service-base-events-rabbitmq"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"img": "https://img.shields.io/npm/dt/@bettercorp/service-base-events-rabbitmq"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"img": "https://img.shields.io/bundlephobia/min/@bettercorp/service-base-events-rabbitmq"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"img": "https://img.shields.io/npm/v/@bettercorp/service-base-events-rabbitmq"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsb/events-rabbitmq",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.6.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "(AGPL-3.0-only OR Commercial)",
|
|
6
6
|
"author": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"testDev": "cross-env TS_NODE_PROJECT=tsconfig.test.json NODE_OPTIONS= mocha"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@bsb/base": "^9.
|
|
45
|
+
"@bsb/base": "^9.6.14"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"amqp-connection-manager": "^5.0.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"anyvali": "^1.0.6"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@bsb/base": "^9.
|
|
53
|
+
"@bsb/base": "^9.6.14",
|
|
54
54
|
"@types/amqplib": "^0.10.4",
|
|
55
55
|
"@types/mocha": "^10.0.6",
|
|
56
56
|
"@types/node": "^25.6.0",
|