command
Version:
v1.7.2
Opens a new window with list of versions in this module.
Published: Feb 26, 2026
License: AGPL-3.0
Opens a new window with license information.
Imports: 5
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Control Plane Example
This example demonstrates the Control Plane features (v1.5+) of lifecycle.
Features Demonstrated
- Control Router: A mux-style event router (
control.Router) that dispatches generic events to handlers.
- Event Sources:
OSSignalSource: Turns SIGINT/SIGTERM into generic events.
TickerSource: Emits periodic "Tick" events (headless progress).
- Managed Concurrency: Uses
lifecycle.Go(ctx, fn) to spawn a background task that is automatically waited for during shutdown.
- Introspection: You can print
router.Routes() to see registered handlers (not shown in output but available).
Run
go run ./examples/control/main.go
Expected Output:
Application started. Press Ctrl+C to exit.
[Background] Task started (will run for 2s)
[Router] Tick(2023-10-27T10:00:00Z)
[Router] Tick(...)
[Background] Task finished
...
(Press Ctrl+C)
[Router] Received Signal: Signal(interrupt)
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.