SAService Architect Back to designer
SAService ArchitectDocumentation
Framework lifecycle StartService / StopService

Go 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

  • initMakers fills missing defaults, then customMakersInit may replace them.
  • initFunctions and infrastructure makers use errgroup for concurrent creation and sibling cancellation.
  • ServiceApp.Start builds streams, starts managed connector cores, storage, pools, components and Sinks, opens managed admission, then starts ordinary Sources and the service HTTP listener.
  • StopService creates one timeout context and drains generated HTTP/gRPC servers before delegating to ServiceApp.Stop.

Go startup sequence

Go shutdown sequence

  • StopService gracefully drains native HTTP and gRPC handlers while endpoint state and graph dependencies remain alive; gRPC uses Stop as 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 stop cleanup run after ServiceApp.Stop.
  • Metrics, tracing, and logs stop after runtime-owned connector resources.

Hooks and boundaries properties

Generated extension points and runtime-owned lifecycle boundaries.

PropertyTypeDescription
initMakersgenerated

Installs defaults only where no maker exists.

customMakersInituser hook

Replaces makers before construction.

customFunctionsInituser hook

Adjusts instances before stream construction.

Start(ctx)runtime

Activates downstream resources before Sources.

Stop(ctx)runtime

Uses the deadline applied by StopService.

Lifecycle outline

configure -> make once -> bind -> start -> admit -> drain -> stop