Ir al contenido

Servicios

Projector

Maintains shared Valkey read models from owner events and serves status, live, stream information and dashboard reads.

En esta página
Esta página aún no está traducida, así que estás leyendo la versión en inglés.

Responsibilities

It folds user, command, module, automation and loyalty events. Writes precede cache invalidation; invalid payloads are acknowledged while storage failures return errors for redelivery. Cold reads can fetch from owners, and background hydration repairs missing sections. Revision checks protect newer state from older updates.

Interfaces

A durable consumer validates events, folds them into shared state and only then broadcasts invalidations. A missing dashboard section can be fetched from its owner; asynchronous hydration repairs the cache without blocking every read. Live lifecycle writes happen before acknowledging the event, while go-live followup work is best effort. Projector does not write Sesame’s live:<id> key.

State and dependencies

Projector stores derived views in Valkey; data services remain authoritative.

Failure behavior

Invalid events are acknowledged; storage errors are returned for redelivery. Revision checks protect newer updates.

An unavailable data owner degrades diagnostics without removing Projector from service. Owner probes run concurrently with a 500 ms deadline each: /readyz stays HTTP 200 while /status reports HTTP 207 and the failing owner. Warm projections and work from other owners continue; a cold read that needs the unavailable owner can still fail. Projector’s own NATS connection, RPC subscription, and stream consumer remain required readiness checks. /healthz remains process-local.

Code map

Source: app/projector/. See main.go, hydration/, rpc/, and internal/projection/.

Validation

Run go test ./app/projector/... ./internal/projection/... from the repository root. See hydration/ and rpc/live.go for ordering and read behavior.