89 lines
1.7 KiB
Markdown
89 lines
1.7 KiB
Markdown
# Management API
|
|
|
|
REST endpoints for operational management.
|
|
|
|
## Overview
|
|
|
|
Management API provides operational endpoints:
|
|
- **Stream Operations** - List, query streams
|
|
- **Subscription Operations** - Query subscriptions
|
|
- **Consumer Operations** - Monitor consumers
|
|
- **Offset Management** - Reset consumer positions
|
|
|
|
## Quick Start
|
|
|
|
```csharp
|
|
using Svrnty.CQRS.Events;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Services.AddEventStreamManagementApi();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Map management endpoints
|
|
app.MapEventStreamManagementApi(routePrefix: "api/event-streams");
|
|
|
|
app.Run();
|
|
```
|
|
|
|
## Available Endpoints
|
|
|
|
### Stream Operations
|
|
|
|
```bash
|
|
# List all streams
|
|
GET /api/event-streams
|
|
Response: [
|
|
{
|
|
"name": "orders",
|
|
"type": "Persistent",
|
|
"length": 15234,
|
|
"subscriptionCount": 3
|
|
}
|
|
]
|
|
|
|
# Get stream details
|
|
GET /api/event-streams/orders
|
|
Response: {
|
|
"name": "orders",
|
|
"type": "Persistent",
|
|
"length": 15234,
|
|
"subscriptions": ["email-processor", "analytics", "inventory-sync"]
|
|
}
|
|
```
|
|
|
|
### Consumer Operations
|
|
|
|
```bash
|
|
# Get consumer status
|
|
GET /api/event-streams/subscriptions/email-processor/consumers/worker-1
|
|
Response: {
|
|
"consumerId": "worker-1",
|
|
"offset": 15000,
|
|
"lag": 234,
|
|
"lastUpdated": "2025-12-10T10:30:00Z",
|
|
"isStalled": false
|
|
}
|
|
|
|
# Reset consumer offset
|
|
POST /api/event-streams/subscriptions/email-processor/consumers/worker-1/reset-offset
|
|
Body: { "newOffset": 0 }
|
|
Response: { "success": true }
|
|
```
|
|
|
|
## Security
|
|
|
|
```csharp
|
|
// Require authorization
|
|
app.MapEventStreamManagementApi()
|
|
.RequireAuthorization("Admin");
|
|
```
|
|
|
|
## See Also
|
|
|
|
- [Observability Overview](../README.md)
|
|
- [Stream Operations](stream-operations.md)
|
|
- [Consumer Operations](consumer-operations.md)
|
|
- [Offset Reset](offset-reset.md)
|