fix(multiplayer): converge events through REST

This commit is contained in:
Josh Creek
2026-09-02 18:54:10 +01:00
parent 91658fbc13
commit 55b88a3aa5
14 changed files with 128 additions and 18 deletions
+6 -4
View File
@@ -8,8 +8,9 @@ import (
)
// OutboxEvent is the durable hand-off between a committed domain mutation and
// transient WebSocket delivery. Consumers must make delivery idempotent by
// event ID and only acknowledge after successful fan-out.
// transient WebSocket publication. Consumers must make publication idempotent
// by event ID and only acknowledge after the local adapter accepts the event.
// Subscriber receipt is not durable; clients converge through REST recovery.
type OutboxEvent struct {
EventID string
AggregateType string
@@ -64,8 +65,9 @@ type OutboxDelivery func(context.Context, OutboxEvent) error
// OutboxDispatcher is the durable-to-transient bridge. Read and Ack are
// injectable so ordering can be tested without a live PostgreSQL instance.
// Delivery is at-least-once: a crash after delivery and before acknowledgement
// leaves the event replayable, while a delivery failure stops the batch.
// Adapter invocation is at-least-once: a crash after invocation and before
// acknowledgement leaves the event replayable, while an adapter failure stops
// the batch. This does not imply that a transient subscriber received it.
type OutboxDispatcher struct {
Read func(context.Context, int) ([]OutboxEvent, error)
Ack func(context.Context, string, time.Time) error