Framework lifecycle
StartService / StopServiceGo lifecycle
Go maker initialization, graph construction, source-last startup, and context-bounded drain.
When to use
Use this page when implementing maker hooks, owning resources, or diagnosing startup and shutdown.
Behavior
initMakersfills missing defaults, thencustomMakersInitmay replace them.initFunctionsand infrastructure makers useerrgroupfor concurrent creation and sibling cancellation.ServiceApp.Startbuilds streams, starts managed connector cores, storage, pools, components and Sinks, opens managed admission, then starts ordinary Sources and the service HTTP listener.StopServicecreates one timeout context and drains generated HTTP/gRPC servers before delegating toServiceApp.Stop.
Go startup sequence
ConfigurationLoad graph configResolve typed service, stream, connector, and endpoint settings.
FactoriesinitMakersInstall defaults, then run
customMakersInit and customFunctionsInit.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.
Go 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.
StopServicegracefully drains native HTTP and gRPC handlers while endpoint state and graph dependencies remain alive; gRPC usesStopas the bounded fallback after the deadline.- The runtime then stops config loading, Components, ordinary DataSources, and its status/metrics HTTP server.
- Managed connector admission stops after ordinary Sources, preserving Cron-to-Temporal work.
- DelayPool, TaskPool, PriorityTaskPool, and storage drain before
app.parallel.Wait(). - DataSinks stop before managed connector clients; generated outbound clients and user
stopcleanup run afterServiceApp.Stop. - Metrics, tracing, and logs stop after runtime-owned connector resources.
Hooks and boundaries properties
Generated extension points and runtime-owned lifecycle boundaries.
PropertyTypeDescription
initMakersgeneratedInstalls defaults only where no maker exists.
customMakersInituser hookReplaces makers before construction.
customFunctionsInituser hookAdjusts instances before stream construction.
Start(ctx)runtimeActivates downstream resources before Sources.
Stop(ctx)runtimeUses the deadline applied by StopService.
Lifecycle outline
configure -> make once -> bind -> start -> admit -> drain -> stop