The three stages of app_t — configure, serve, stop

run(argc, argv) blocks, and its return value is the exit code

The three stages of app_t — configure, serve, stop run(argc, argv) blocks, and its return value is the exit code create() · Architecture component create() configure · config, logging, registration · Architecture component configure config, logging, registration serving · channel, HTTP, spot dispatch · Architecture component serving channel, HTTP, spot dispatch stopping · hosted services torn down · Architecture component stopping hosted services torn down exit · Architecture component exit run(argc, argv) stop(), request_stop(), a signal returns the exit code

Configure

  • • Everything is declared before run — config/logging, add_zlink_framework, add_hosted_service.
  • • An invalid configuration is rejected with an exception, either at declaration time or as run starts.

Stopping

  • • request_stop() is the asynchronous request (from a signal handler, say); stop() stops synchronously.
  • • Registered hosted services are stopped in reverse order; channels, streams and HTTP are hosted services too, so they unwind the same way.