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.
BindingBuild graph and endpointsBind streams, callers, endpoint consumers, functions, and transport routes.
Connector coreOpen clientsStart managed connector clients before anything can submit or poll.
DownstreamStart graph resourcesStart storage, pools, components, and Sinks before inbound work.
Worker admissionStart managed pollingOpen Temporal or other connector-owned inbound workers after Sinks are ready.
SourcesStart DataSourcesOpen ordinary graph admission only after every downstream dependency is ready.
ServersStart listenersOpen generated HTTP and gRPC listeners after endpoint bindings and graph resources are ready.
Rust shutdown sequence
SignalStop requestedCreate one deadline from
shutdownTimeout.NetworkClose listenersReject new HTTP/gRPC requests and drain accepted handlers while graph dependencies remain alive.
SourcesDrain root workStop ordinary DataSources and admission-aware components.
WorkersStop managed admissionStop connector-owned polling only after ordinary Sources have drained.
ProducersPools, timers, storageStop admission and drain tasks that can still create graph work.
GraphParallelCall registryDrain only after no producer can create another child.
OutputStop DataSinksFlush results and accepted outbound submissions.
Connector coreClose clientsRelease managed connector clients after Sources, graph work, and Sinks no longer need them.
ReleaseRelease graph ownershipDrop endpoint consumers, streams, functions, and bindings only after their callbacks cannot run.
TelemetryFlush diagnosticsMetrics, traces, and logs cover shutdown and stop at the final safe boundary.
- HTTP and gRPC cancellation tokens close network admission, and native server tasks are awaited before graph-owned resources stop.
- DataSources and Components then stop concurrently.
- Task pools, priority pools, DelayPool, and storage stop before
drain_parallel. - DataSinks stop after nested graph work; runtime metrics, metrics, and tracing are flushed afterward.
- Endpoint-consumer ownership is explicitly cleared after connectors and telemetry no longer need it, breaking environment
Arccycles before the Stopped state. - The terminal lifecycle log is emitted before the logs engine shuts down.
- 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