Files
dbis_core/docs/solacenet/GATEWAY_ADAPTER_LIFECYCLE.md

12 lines
758 B
Markdown
Raw Normal View History

# Gateway rail adapter lifecycle (DI policy)
**Gap:** PG-GW-W01 (singleton vs per-request).
**Policy (until superseded by performance review):**
1. **HTTP (`/api/v1/gateway/rails/*`)**`createGatewayRailAdapter(id)` returns a **new instance per request** after `registry` lookup. Do **not** cache adapter instances on the Express router.
2. **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.
3. **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`.