docs consoliation work
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
# Router · Messaging Transport over Valkey (Draft v0.1)
|
||||
# Router · Messaging Transport over Valkey
|
||||
|
||||
## Status
|
||||
- Draft; intended for implementation via a dedicated sprint.
|
||||
- Last updated: 2025-12-23 (UTC).
|
||||
- **Implemented** in Sprint 8100.0011.0003.
|
||||
- Core components: Gateway DI wiring, GatewayHostedService integration, GatewayTransportClient dispatch.
|
||||
- Last updated: 2025-12-24 (UTC).
|
||||
|
||||
## Purpose
|
||||
Enable Gateway ↔ microservice Router traffic over an offline-friendly, Redis-compatible transport (Valkey) by using the existing **Messaging** transport layer:
|
||||
@@ -11,15 +12,18 @@ Enable Gateway ↔ microservice Router traffic over an offline-friendly, Redis-c
|
||||
|
||||
This supports environments where direct TCP/TLS microservice connections are undesirable, and where an internal message bus is the preferred control plane.
|
||||
|
||||
## What Exists Today (Repository Reality)
|
||||
- Messaging transport server/client:
|
||||
- `src/__Libraries/StellaOps.Router.Transport.Messaging/MessagingTransportServer.cs`
|
||||
- `src/__Libraries/StellaOps.Router.Transport.Messaging/MessagingTransportClient.cs`
|
||||
- Valkey-backed message queue factory:
|
||||
- `src/__Libraries/StellaOps.Messaging.Transport.Valkey/ValkeyMessageQueueFactory.cs`
|
||||
- Gateway WebService currently starts only TCP/TLS transport servers:
|
||||
- `src/Gateway/StellaOps.Gateway.WebService/Program.cs`
|
||||
- `src/Gateway/StellaOps.Gateway.WebService/Services/GatewayHostedService.cs`
|
||||
## Implementation Summary
|
||||
|
||||
### Libraries
|
||||
- `StellaOps.Router.Transport.Messaging` — Router transport layer over messaging
|
||||
- `StellaOps.Messaging.Transport.Valkey` — Valkey/Redis backend for messaging
|
||||
- `StellaOps.Messaging` — Core messaging abstractions and DI
|
||||
|
||||
### Gateway Integration
|
||||
- **Program.cs** — Conditional registration of `ValkeyTransportPlugin` and `AddMessagingTransportServer()`
|
||||
- **GatewayOptions.cs** — `GatewayMessagingTransportOptions` for Valkey connection and queue configuration
|
||||
- **GatewayHostedService.cs** — Start/stop `MessagingTransportServer`, subscribe to events
|
||||
- **GatewayTransportClient.cs** — Dispatch to `TransportType.Messaging` connections
|
||||
|
||||
## High-Level Flow
|
||||
1) Microservice connects via messaging transport:
|
||||
@@ -39,14 +43,35 @@ The Messaging transport uses a small set of queues (names are configurable):
|
||||
- **Per-service request queues**: gateway publishes REQUEST frames targeted to a service
|
||||
- **Dead letter queues** (optional): for messages that exceed retries/leases
|
||||
|
||||
## Configuration (Draft)
|
||||
### Gateway
|
||||
- Register Valkey messaging services (`StellaOps.Messaging.Transport.Valkey`)
|
||||
- Add messaging transport server (`AddMessagingTransportServer`)
|
||||
- Add Gateway config section for messaging transport options:
|
||||
- Valkey connection info (host/port/auth)
|
||||
- queue naming prefix
|
||||
- consumer group / lease duration / dead-letter suffix
|
||||
## Configuration
|
||||
|
||||
### Gateway YAML Configuration
|
||||
```yaml
|
||||
Gateway:
|
||||
Transports:
|
||||
Messaging:
|
||||
Enabled: true
|
||||
ConnectionString: "valkey:6379"
|
||||
Database: 0
|
||||
RequestQueueTemplate: "router:requests:{service}"
|
||||
ResponseQueueName: "router:responses"
|
||||
ConsumerGroup: "router-gateway"
|
||||
RequestTimeout: "30s"
|
||||
LeaseDuration: "5m"
|
||||
BatchSize: 10
|
||||
HeartbeatInterval: "10s"
|
||||
```
|
||||
|
||||
### Gateway DI Registration
|
||||
```csharp
|
||||
// In Program.cs (already implemented)
|
||||
if (bootstrapOptions.Transports.Messaging.Enabled)
|
||||
{
|
||||
builder.Services.AddMessagingTransport<ValkeyTransportPlugin>(
|
||||
builder.Configuration, "Gateway:Transports:Messaging");
|
||||
builder.Services.AddMessagingTransportServer();
|
||||
}
|
||||
```
|
||||
|
||||
### Microservice
|
||||
- Register Valkey messaging services (`StellaOps.Messaging.Transport.Valkey`)
|
||||
@@ -63,13 +88,20 @@ The Messaging transport uses a small set of queues (names are configurable):
|
||||
- The Gateway must not trust client-supplied identity headers; it must overwrite reserved headers before dispatch.
|
||||
- See `docs/modules/gateway/identity-header-policy.md`.
|
||||
|
||||
## Gaps / Implementation Work
|
||||
1) Wire Messaging transport into Gateway:
|
||||
- start/stop `MessagingTransportServer`
|
||||
- subscribe to HELLO/HEARTBEAT/RESPONSE events and reuse existing HELLO validation + routing state updates
|
||||
2) Extend Gateway transport client to support `TransportType.Messaging` for dispatch.
|
||||
3) Add config mapping and deployment examples (compose/helm) for Valkey transport.
|
||||
4) Add integration tests covering:
|
||||
## Implementation Status
|
||||
|
||||
### Completed (Sprint 8100.0011.0003)
|
||||
1. ✅ Wire Messaging transport into Gateway:
|
||||
- start/stop `MessagingTransportServer` in `GatewayHostedService`
|
||||
- subscribe to `OnHelloReceived`, `OnHeartbeatReceived`, `OnResponseReceived`, `OnConnectionClosed` events
|
||||
- reuse routing state updates and claims store updates
|
||||
2. ✅ Extend Gateway transport client to support `TransportType.Messaging` for dispatch.
|
||||
3. ✅ Add config options (`GatewayMessagingTransportOptions`) and DI mappings.
|
||||
|
||||
### Remaining Work
|
||||
1. Add deployment examples (compose/helm) for Valkey transport.
|
||||
2. Add integration tests using ValkeyFixture:
|
||||
- microservice HELLO registration via messaging
|
||||
- request dispatch + response return
|
||||
3. Validate streaming support (or document as out-of-scope).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user