Framework lifecycle
ServiceGenerated.run / ServiceRuntimeTypeScript lifecycle
Promise makers, runtime component categories, startup rollback, task admission, and bounded stop.
When to use
Use this page when implementing maker hooks, owning resources, or diagnosing startup and shutdown.
Behavior
- Default maker objects exist before
customMakersInit. initInfrastructureandinitFunctionsParallelcreate long-lived instances before bindings.ServiceRuntimevalidates topology and starts categories ending with Sources and HTTP.- The runner passes
serviceConfig.shutdownTimeoutintoapp.stop.
TypeScript startup sequence
ConfigurationLoad graph configResolve typed service, stream, connector, and endpoint settings.
FactoriesdefaultMakersInstall defaults, then run
customMakersInit, customFunctionsInit, and onStart.ConstructionInvoke makers onceCreate infrastructure and long-lived functions in parallel.
GraphBuild and bindConstruct streams, callers, endpoint consumers, and transports.
StartOpen admission lastStart dependencies and Sinks before Sources and servers.
TypeScript shutdown sequence
SignalStop requestedCreate one deadline from
shutdownTimeout.AdmissionListeners and SourcesReject new root work and drain accepted calls.
GraphNested workKeep pools, storage, Sinks, and clients alive.
ResourcesPools, storage, SinksRelease graph dependencies in safe order.
TelemetryFlush and releaseMetrics, traces, and logs stop last.
- Stopping during startup aborts startup and waits for rollback.
- Admission-aware components receive
stopAdmission. - RuntimeTaskRegistry rejects new work and drains nested tasks.
- Pools/storage, Sinks, connectors, and telemetry stop in ordered groups.
Startup rollback
On component start failure, already-started components stop in reverse order with startup cancellation removed. The original startup error is preserved.
Hooks and boundaries properties
Generated extension points and runtime-owned lifecycle boundaries.
PropertyTypeDescription
customMakersInituser hookReplaces maker fields before invocation.
initFunctionsParallelgeneratedRuns independent makers as Promises.
ServiceRuntime.registerconstructionRegisters lifecycle objects only before start.
START_ORDERruntime contractTelemetry, connectors, storage, pools, components, Sinks, Sources, HTTP.
RuntimeTaskRegistrydrain boundaryTracks nested work and closes task admission.
Lifecycle outline
configure -> make once -> bind -> start -> admit -> drain -> stop