SAService Architect Back to designer
SAService ArchitectDocumentation
Framework lifecycle ServiceGenerated::start / stop

C++ userver lifecycle

userver task-based makers, ordered activation, and ownership-safe timeout handling.

When to use

Use this page when implementing maker hooks, owning resources, or diagnosing startup and shutdown.

Behavior

  • serviceInit, initMakers, and customMakersInit precede initRuntime.
  • Infrastructure and function makers run as named userver async tasks; first failure requests cancellation and is rethrown.
  • ServiceApp::start starts execution runtime and activates lifecycle categories in dependency order.
  • Stop closes non-Sink resources, drains graph execution, then stops Sinks.

C++ userver startup sequence

C++ userver shutdown sequence

  • Context::bounded(shutdownTimeout) supplies the shared deadline.
  • Components stop in reverse dependency order with timeout telemetry.
  • Sinks remain alive until graph drain.
  • Timed-out graph ownership is preserved to avoid dangling callbacks.

Hooks and boundaries properties

Generated extension points and runtime-owned lifecycle boundaries.

PropertyTypeDescription
initMakersgenerated

Assigns asynchronous maker callables.

customMakersInitvirtual hook

Overrides defaults before maker tasks.

initRuntimegenerated

Makes objects, builds graph, and registers lifecycle entries.

serviceStarteduser hook

Runs after ServiceApp startup.

stopruntime

Idempotent and called by the destructor.

Lifecycle outline

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