Framework lifecycle
GeneratedService::new / runRust lifecycle
Typed maker tables, concurrent futures, immutable assembly, Tokio servers, and bounded drain.
When to use
Use this page when implementing maker hooks, owning resources, or diagnosing startup and shutdown.
Behavior
ServiceMakers::defaultis mutated bycustom_makers_initbefore invocation.- Function and infrastructure maker groups run concurrently with a cancellable child context.
GeneratedService::newbinds streams and connectors;runopens the app and waits for termination.ServiceApp::stopappliesshutdown_timeoutand drains HTTP/gRPC before graph resources.
Rust startup sequence
ConfigurationLoad graph configResolve typed service, stream, connector, and endpoint settings.
FactoriesServiceMakers::defaultInstall defaults, then run
custom_makers_init and custom_functions_init.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.
Rust 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.
- HTTP and gRPC tokens close network admission.
- Sources and components stop concurrently.
drain_parallelcompletes nested work before pools and storage.- Startup failure transitions through normal stop cleanup.
Hooks and boundaries properties
Generated extension points and runtime-owned lifecycle boundaries.
PropertyTypeDescription
ServiceMakersgenerated structTyped Arc closures for factories.
custom_makers_inituser functionMutates makers before async initialization.
GeneratedService::newconstructionBuilds and binds without opening admission.
ServiceApp::startactivationStarts Sinks before Sources and servers.
ServiceApp::stopdrainApplies service timeout and records telemetry.
Lifecycle outline
configure -> make once -> bind -> start -> admit -> drain -> stop