758 B
758 B
Gateway rail adapter lifecycle (DI policy)
Gap: PG-GW-W01 (singleton vs per-request).
Policy (until superseded by performance review):
- HTTP (
/api/v1/gateway/rails/*) —createGatewayRailAdapter(id)returns a new instance per request afterregistrylookup. Do not cache adapter instances on the Express router. - Long-lived workers — if a worker holds a connector with sockets or session state, that worker process owns one instance per
adapterId; document in the worker module. - Secrets —
initialize(config, secretsRef)is the hook for KMS/HSM-backed config; REST routes still pass{}until per-rail secrets routing is implemented.
Related: gateway-adapter-registry.ts, gateway.routes.ts.