Run the system manager
Edit this pageSystem · Related pages
Run(ctx context.Context) errorClaims the system manager role and runs the installation’s eligible workers.
The call blocks until its context is cancelled. Multiple processes can call
Run, while the manager row admits one reconciliation loop at a time.
Example
Use an initialized client and a registered system.
ctx, stop := sqlstreams.LifecycleContext(nil)defer stop()
if err := client.Manager().Run(ctx); err != nil { return err}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context |
Yes | Application-lifetime context. Cancellation requests shutdown. A context that never cancels keeps Run active indefinitely. |
Returns
| Condition | Return value |
|---|---|
| Context is cancelled | nil after the running loop stops. |
| System has not been registered | ErrNotRegistered. |
| Initial setup fails | The setup or database error. |
Worker execution
The manager coordinates declared maintenance, schedules, cursor advancement, metric collection, and alert evaluation. A declaration must exist and permit instances before its worker can run.
By default, Consume runs this manager alongside a cancellable session. Setting
ClientConfig.DisableManager disables that automatic manager, while explicit
Manager.Run remains available. It does not disable the consumer’s stream janitor.
If the manager loop ends before cancellation, Run waits with backoff and
tries again. A failed loop emits SQL0065. Cancelling the context ends this
retry cycle.
CLI
sqlstreams manager runRuns until shutdown is requested. See Manager commands for its signal behavior and metrics endpoint options.
Errors
| Error | When |
|---|---|
ErrNotRegistered |
No system baseline exists. |
| Database or setup error | The initial owner lookup or runner construction fails. |
Related topics
- Register the system — Declare workers, schedules, and collector settings.
- Create a shutdown context — Signal-driven cancellation.
- Background managers and workers — Manager ownership, heartbeats, and takeover.
- Worker is not running — Investigate missing maintenance.