mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-15 08:12:15 +00:00
fix(multiplayer): converge events through REST
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user