@venizia/ignis-docs 0.0.7-2 → 0.0.7
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/package.json +1 -1
- package/wiki/references/helpers/kafka/admin.md +21 -16
- package/wiki/references/helpers/kafka/consumer.md +208 -297
- package/wiki/references/helpers/kafka/examples.md +211 -84
- package/wiki/references/helpers/kafka/index.md +280 -126
- package/wiki/references/helpers/kafka/producer.md +92 -88
- package/wiki/references/helpers/kafka/schema-registry.md +214 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ignis-docs",
|
|
3
|
-
"version": "0.0.7
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Interactive documentation site and MCP (Model Context Protocol) server for the Ignis Framework. Includes a VitePress-powered documentation site with guides, API references, and best practices. Ships an MCP server (CLI: ignis-docs-mcp) with 11 tools for AI assistants to search docs, browse source code, verify dependencies, and access real-time framework knowledge. Built with Mastra MCP SDK and Fuse.js fuzzy search.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Admin
|
|
2
2
|
|
|
3
|
-
The `KafkaAdminHelper`
|
|
3
|
+
The `KafkaAdminHelper` wraps `@platformatic/kafka`'s `Admin` with health tracking, graceful shutdown, and broker event callbacks. Use `getAdmin()` to access the full Admin API directly.
|
|
4
4
|
|
|
5
5
|
```typescript
|
|
6
|
-
class KafkaAdminHelper extends
|
|
6
|
+
class KafkaAdminHelper extends BaseKafkaHelper<Admin>
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
@@ -15,13 +15,19 @@ class KafkaAdminHelper extends BaseHelper
|
|
|
15
15
|
|--------|-----------|-------------|
|
|
16
16
|
| `newInstance(opts)` | `static newInstance(opts): KafkaAdminHelper` | Factory method |
|
|
17
17
|
| `getAdmin()` | `(): Admin` | Access the underlying `Admin` |
|
|
18
|
-
| `
|
|
18
|
+
| `isHealthy()` | `(): boolean` | `true` when broker connected |
|
|
19
|
+
| `isReady()` | `(): boolean` | Same as `isHealthy()` |
|
|
20
|
+
| `getHealthStatus()` | `(): TKafkaHealthStatus` | `'connected'` \| `'disconnected'` \| `'unknown'` |
|
|
21
|
+
| `close(opts?)` | `(opts?: { isForce?: boolean }): Promise<void>` | Close the admin connection (default: graceful) |
|
|
19
22
|
|
|
20
|
-
##
|
|
23
|
+
## IKafkaAdminOptions
|
|
21
24
|
|
|
22
25
|
```typescript
|
|
23
|
-
interface
|
|
24
|
-
identifier?: string;
|
|
26
|
+
interface IKafkaAdminOptions extends IKafkaConnectionOptions {
|
|
27
|
+
identifier?: string; // Default: 'kafka-admin'
|
|
28
|
+
shutdownTimeout?: number; // Default: 30000ms
|
|
29
|
+
onBrokerConnect?: TKafkaBrokerEventCallback;
|
|
30
|
+
onBrokerDisconnect?: TKafkaBrokerEventCallback;
|
|
25
31
|
}
|
|
26
32
|
```
|
|
27
33
|
|
|
@@ -35,23 +41,27 @@ import { KafkaAdminHelper } from '@venizia/ignis-helpers/kafka';
|
|
|
35
41
|
const helper = KafkaAdminHelper.newInstance({
|
|
36
42
|
bootstrapBrokers: ['localhost:9092'],
|
|
37
43
|
clientId: 'my-admin',
|
|
44
|
+
onBrokerConnect: ({ broker }) => console.log(`Connected to ${broker.host}:${broker.port}`),
|
|
45
|
+
onBrokerDisconnect: ({ broker }) => console.log(`Disconnected from ${broker.host}`),
|
|
38
46
|
});
|
|
39
47
|
|
|
40
48
|
const admin = helper.getAdmin();
|
|
41
49
|
|
|
42
|
-
// Create a topic
|
|
50
|
+
// Create a topic
|
|
43
51
|
await admin.createTopics({ topics: ['orders'], partitions: 3, replicas: 2 });
|
|
44
52
|
|
|
45
53
|
// List all topics
|
|
46
54
|
const topics = await admin.listTopics();
|
|
47
55
|
|
|
48
|
-
//
|
|
49
|
-
|
|
56
|
+
// Health check
|
|
57
|
+
helper.isHealthy(); // true when connected
|
|
50
58
|
|
|
59
|
+
// Graceful close
|
|
51
60
|
await helper.close();
|
|
52
|
-
```
|
|
53
61
|
|
|
54
|
-
|
|
62
|
+
// Or force close
|
|
63
|
+
await helper.close({ isForce: true });
|
|
64
|
+
```
|
|
55
65
|
|
|
56
66
|
## API Reference (`@platformatic/kafka`)
|
|
57
67
|
|
|
@@ -110,11 +120,6 @@ for (const [groupId, group] of details) {
|
|
|
110
120
|
console.log(`Group: ${groupId}, State: ${group.state}`);
|
|
111
121
|
for (const [memberId, member] of group.members) {
|
|
112
122
|
console.log(` Member: ${member.clientId} (${member.clientHost})`);
|
|
113
|
-
if (member.assignments) {
|
|
114
|
-
for (const [topic, assignment] of member.assignments) {
|
|
115
|
-
console.log(` ${topic}: partitions ${assignment.partitions.join(', ')}`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
123
|
}
|
|
119
124
|
}
|
|
120
125
|
```
|