api-shared-infrastructure
Event store en PostgreSQL y el camino de los eventos hasta la lectura.
- Import:
@task-stream/api/shared/infrastructure - Capa:
infrastructure· Tags:scope:api-shared,type:infrastructure
Contenido
PostgresEventStore(tablaevents,UNIQUE(stream_id, position)→ConcurrencyError).EventSerializer/EventDeserializeryEventStorePublisher(sustituye al publisher delEventBus:commit()persiste).EventStoreRelay: copia los eventos nuevos al Redis Stream (FOR UPDATE SKIP LOCKED).EventsBridge: consume el stream y entrega cada evento a sus@EventsHandler, en orden y esperando (ACK al final).- Conexiones Redis (
REDIS_CLIENT,GRAPHQL_PUB_SUB) ySharedInfrastructureModule.forRootAsync.
Flujo completo: Arquitectura.
Comandos
npx nx lint api-shared-infrastructure
npx nx test api-shared-infrastructure # Jest
Reglas de dependencia entre capas: Arquitectura.