Add identity-first CultMesh application client
This commit is contained in:
parent
bc8270ecc3
commit
6403744ada
3 changed files with 255 additions and 20 deletions
|
|
@ -7,31 +7,22 @@ path rotation, and transport failure state.
|
|||
```csharp
|
||||
using GameCult.Mesh;
|
||||
|
||||
using var discovery = new CultMeshDiscoveryService(new ICultMeshLookupSource[]
|
||||
using var mesh = new CultMeshClient(new CultMeshClientOptions
|
||||
{
|
||||
odinLookupSource
|
||||
RendezvousEndpoints = new[] { "rudp://odin.gamecult.net:3076" }
|
||||
});
|
||||
|
||||
using var sessions = new CultMeshSessionManager(
|
||||
discovery,
|
||||
new ICultMeshTransportConnector[]
|
||||
{
|
||||
new CultMeshSchemaTransportConnector()
|
||||
});
|
||||
|
||||
var provider = CultMeshEndpointId.Parse("aetheria.daemon");
|
||||
var session = await sessions.ConnectAsync(
|
||||
provider,
|
||||
var session = await mesh.ConnectAsync(
|
||||
"aetheria.daemon",
|
||||
CultMeshProtocols.Documents,
|
||||
cancellationToken);
|
||||
|
||||
using var client = session.OpenSchemaClient();
|
||||
```
|
||||
|
||||
Keep `discovery` and `sessions` for the application lifetime. Do not construct
|
||||
them per request. `session` is the logical connection: when Odin advertises a
|
||||
new physical route after a partition, the same session migrates and retains its
|
||||
typed handler registrations.
|
||||
Keep `mesh` for the application lifetime. `session` is the logical connection:
|
||||
when Odin advertises a new physical route after a partition, the same session
|
||||
migrates and retains its typed handler registrations.
|
||||
|
||||
Watch connection state for presentation and diagnostics:
|
||||
|
||||
|
|
@ -49,9 +40,8 @@ Verification:
|
|||
dotnet test tests/GameCult.Mesh.Tests/GameCult.Mesh.Tests.csproj --filter FullyQualifiedName~CultMeshSessionManagerTests
|
||||
```
|
||||
|
||||
The explicit organ construction above is the current low-level API. The
|
||||
identity-first `mesh.ConnectAsync(...)` facade remains planned work; this guide
|
||||
will collapse to that form when it lands.
|
||||
Advanced hosts may inject lookup sources, connectors, clocks, persistence, and
|
||||
diagnostics through the lower-level discovery and session APIs. Application
|
||||
features should not need them.
|
||||
|
||||
Next: [publish one Eve surface to multiple runtimes](03-publish-an-eve-surface.md).
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue