SQLStreams

the messaging platform that is just Postgres

You last visited on 9999-99-99 Show what's new since then

Run the system manager

Edit this page
System · Related pages
Posted: 2026-09-17 · Report this thread
brandon Site Admin brandon profile Posts: 96
Run(ctx context.Context) error

Claims 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 run

Runs 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.