Anarchy.Toolkit.Hosting
Part of Anarchy I/O Toolkit, a .NET developer platform · Pillar: Infrastructure · Layer: Hosting · Package catalog
Generic startup and entry-point infrastructure for jobs and worker processes.
dotnet add package Anarchy.Toolkit.Hosting
- Implement
IStartupand useUseStartup<TStartup>(appRunnerType)to compose a host. - Build jobs and workers with
JobStartupBase,JobEntryPointBase,WorkerEntryPointBaseandAppHostBuilder. - Override
ConfigureAppConfigurationto select the application’s configuration sources;DiFactory<TAppSettingsDiModule, TAppSettings>builds the service container.
When to use it
Use Hosting for the composition and lifecycle of a job or worker that is not itself an HTTP API. It separates application startup and service registration from the executable entry point, allowing the same conventions to be used in different hosting environments.
How to use it
- Define your settings and settings module using
Anarchy.Toolkit.Configuration. - Implement an
IStartupor derive from the relevant startup base. Register application services and any toolkit modules in the startup’s service-configuration hook. - Create an entry point using the appropriate job or worker base; run the host and dispose it when the process exits. Select configuration sources in
ConfigureAppConfigurationwhen the defaults are insufficient.
See the runnable worker startup, worker entry point, and Lambda job for concrete implementations. For REST endpoints, use Anarchy.Toolkit.Web; for long-running worker and health primitives, add Hosting.Workers.
See the sample applications and toolkit overview.
Releases
See the release notes for the complete release history.