@orbit-stream/redpanda 1.0.0 → 1.0.2
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 +142 -29
- package/index.js +3 -0
- package/package.json +2 -2
- package/src/examples/consumer.js +15 -0
- package/src/examples/producer.js +17 -0
package/README.md
CHANGED
|
@@ -1,67 +1,180 @@
|
|
|
1
|
-
# orbit-stream-redpanda
|
|
2
|
-
|
|
3
|
-
High-performance Redpanda transport adapter for Orbit Stream.
|
|
4
|
-
|
|
5
1
|
# @orbit-stream/redpanda
|
|
6
2
|
|
|
7
3
|
High-performance Redpanda transport adapter for Orbit Stream.
|
|
8
4
|
|
|
9
5
|
Optimized for:
|
|
10
6
|
|
|
11
|
-
- high-throughput telemetry
|
|
12
|
-
- binary
|
|
13
|
-
-
|
|
14
|
-
- low-latency
|
|
15
|
-
- backpressure-aware
|
|
7
|
+
- high-throughput telemetry streaming
|
|
8
|
+
- binary payload processing
|
|
9
|
+
- batch publishing and consumption
|
|
10
|
+
- low-latency message delivery
|
|
11
|
+
- backpressure-aware streaming
|
|
12
|
+
- large-scale distributed consumers
|
|
16
13
|
|
|
17
14
|
---
|
|
18
15
|
|
|
19
16
|
# Installation
|
|
20
17
|
|
|
21
|
-
```bash
|
|
18
|
+
```bash
|
|
22
19
|
npm install @orbit-stream/redpanda
|
|
23
20
|
```
|
|
24
21
|
|
|
25
22
|
---
|
|
26
23
|
|
|
24
|
+
# Features
|
|
25
|
+
|
|
26
|
+
- KafkaJS based transport
|
|
27
|
+
- Redpanda optimized architecture
|
|
28
|
+
- Batch publishing support
|
|
29
|
+
- Batch consumption support
|
|
30
|
+
- Buffer-first design
|
|
31
|
+
- Backpressure-aware processing
|
|
32
|
+
- High-throughput optimized
|
|
33
|
+
- Binary payload support
|
|
34
|
+
- Transport-independent OrbitStream API
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
27
38
|
# Usage
|
|
28
39
|
|
|
29
|
-
```js
|
|
30
|
-
const {
|
|
40
|
+
```js
|
|
41
|
+
const { OrbitStream } = require("@orbit-stream/redpanda");
|
|
31
42
|
|
|
32
|
-
|
|
33
|
-
|
|
43
|
+
async function main() {
|
|
44
|
+
const stream = new OrbitStream({
|
|
45
|
+
brokers: ["localhost:9092"],
|
|
34
46
|
|
|
35
|
-
|
|
47
|
+
groupId: "telemetry-group",
|
|
36
48
|
|
|
37
|
-
|
|
49
|
+
batchSize: 5000,
|
|
50
|
+
|
|
51
|
+
flushInterval: 100,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
await stream.connect();
|
|
55
|
+
|
|
56
|
+
await stream.publish("telemetry", {
|
|
57
|
+
value: Buffer.from("hello"),
|
|
58
|
+
});
|
|
38
59
|
|
|
39
|
-
|
|
60
|
+
await stream.subscribe(
|
|
61
|
+
"telemetry",
|
|
62
|
+
|
|
63
|
+
async (messages) => {
|
|
64
|
+
console.log(messages.length);
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
main();
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
# Producer Example
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
const { OrbitStream } = require("@orbit-stream/redpanda");
|
|
78
|
+
|
|
79
|
+
const stream = new OrbitStream({
|
|
80
|
+
brokers: ["localhost:9092"],
|
|
81
|
+
|
|
82
|
+
clientId: "telemetry-producer",
|
|
40
83
|
});
|
|
41
84
|
|
|
42
85
|
await stream.connect();
|
|
43
86
|
|
|
44
87
|
await stream.publish("telemetry", {
|
|
45
|
-
value: Buffer.from("
|
|
88
|
+
value: Buffer.from("payload"),
|
|
46
89
|
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
# Consumer Example
|
|
47
95
|
|
|
48
|
-
|
|
49
|
-
|
|
96
|
+
```js
|
|
97
|
+
const { OrbitStream } = require("@orbit-stream/redpanda");
|
|
98
|
+
|
|
99
|
+
const stream = new OrbitStream({
|
|
100
|
+
brokers: ["localhost:9092"],
|
|
101
|
+
|
|
102
|
+
groupId: "telemetry-group",
|
|
50
103
|
});
|
|
104
|
+
|
|
105
|
+
await stream.connect();
|
|
106
|
+
|
|
107
|
+
await stream.subscribe(
|
|
108
|
+
"telemetry",
|
|
109
|
+
|
|
110
|
+
async (messages) => {
|
|
111
|
+
console.log("received:", messages.length);
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
{
|
|
115
|
+
partitionsConsumedConcurrently: 8,
|
|
116
|
+
},
|
|
117
|
+
);
|
|
51
118
|
```
|
|
52
119
|
|
|
53
120
|
---
|
|
54
121
|
|
|
55
|
-
#
|
|
122
|
+
# Recommended Configuration
|
|
56
123
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
124
|
+
## Standard Telemetry
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
{
|
|
128
|
+
batchSize: 5000,
|
|
129
|
+
flushInterval: 100
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## High Throughput Telemetry (~800 Mbps)
|
|
136
|
+
|
|
137
|
+
```js
|
|
138
|
+
{
|
|
139
|
+
batchSize: 10000,
|
|
140
|
+
flushInterval: 50,
|
|
141
|
+
maxInFlightRequests: 10
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
# Architecture
|
|
148
|
+
|
|
149
|
+
```txt
|
|
150
|
+
Telemetry Source
|
|
151
|
+
│
|
|
152
|
+
▼
|
|
153
|
+
OrbitStream Producer
|
|
154
|
+
│
|
|
155
|
+
▼
|
|
156
|
+
Redpanda Cluster
|
|
157
|
+
│
|
|
158
|
+
▼
|
|
159
|
+
Consumer Group
|
|
160
|
+
│
|
|
161
|
+
▼
|
|
162
|
+
Telemetry Processors
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
# Package Architecture
|
|
168
|
+
|
|
169
|
+
Orbit Stream uses modular transport packages:
|
|
170
|
+
|
|
171
|
+
| Package | Purpose |
|
|
172
|
+
| ------------------------ | ------------------------------- |
|
|
173
|
+
| `@orbit-stream/core` | Shared interfaces and utilities |
|
|
174
|
+
| `@orbit-stream/redpanda` | Redpanda transport |
|
|
175
|
+
| `@orbit-stream/valkey` | Valkey Streams transport |
|
|
176
|
+
|
|
177
|
+
Applications install only the transport they use.
|
|
65
178
|
|
|
66
179
|
---
|
|
67
180
|
|
package/index.js
ADDED
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { OrbitStream } = require("@orbit-stream/redpanda");
|
|
2
|
+
async function main() {
|
|
3
|
+
const stream = new OrbitStream({
|
|
4
|
+
brokers: ["localhost:9092"],
|
|
5
|
+
groupId: "test-group",
|
|
6
|
+
});
|
|
7
|
+
await stream.connect();
|
|
8
|
+
console.log("consumer connected");
|
|
9
|
+
await stream.subscribe("telemetry", async (messages) => {
|
|
10
|
+
for (let i = 0; i < messages.length; i++) {
|
|
11
|
+
console.log(messages[i].value.toString());
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { OrbitStream } = require("@orbit-stream/redpanda");
|
|
2
|
+
async function main() {
|
|
3
|
+
const stream = new OrbitStream({
|
|
4
|
+
brokers: ["localhost:9092"],
|
|
5
|
+
clientId: "test-producer",
|
|
6
|
+
batchSize: 1000,
|
|
7
|
+
flushInterval: 100,
|
|
8
|
+
});
|
|
9
|
+
await stream.connect();
|
|
10
|
+
console.log("producer connected");
|
|
11
|
+
let counter = 0;
|
|
12
|
+
setInterval(async () => {
|
|
13
|
+
const payload = Buffer.from(`packet-${counter++}`);
|
|
14
|
+
await stream.publish("telemetry", { value: payload });
|
|
15
|
+
}, 100);
|
|
16
|
+
}
|
|
17
|
+
main().catch(console.error);
|