Skip to content

Control ​

pythonpython
from rillkit import Broker, Control

Control says whether and how a broker is managed by a control plane. With it on, broker.control is the running ControlPlane. The control plane guide explains the behaviour; this page lists the API.

Control ​

pythonpython
Control(
    mode: str = "off",
    url: Optional[str] = None,
    api_key: Optional[str] = None,
    node_id: Optional[str] = None,
    heartbeat_interval: float = 10.0,
    refresh_interval: float = 30.0,
    capture_logs: bool = False,
    insecure: bool = False,
    inspect_messages: bool = False,
    trace_records: bool = False,
)
FieldVariableDefaultDescription
modeRILLKIT_CONTROLoffoff: the plain library. relay: connect to rillkit-server for telemetry, directives and the dashboard.
urlRILLKIT_CONTROL_URLNonerelay: the server, https://... or wss://... (the Relay path /relay/v1 is added).
api_keyRILLKIT_API_KEYNonerelay: the worker's API key. Shown as *** in repr.
node_idRILLKIT_NODE_ID<hostname>-<pid>This process's name on the control plane.
heartbeat_interval10.0Seconds between node heartbeats.
refresh_interval30.0Seconds between re-reads of the desired state, in case a wakeup was lost.
capture_logsRILLKIT_CAPTURE_LOGSFalseAdd LogCapture, so the dashboard can show each message's logs.
inspect_messagesRILLKIT_INSPECT_MESSAGESFalseLet the control plane read payloads and DLQ error texts, and edit DLQ entries before replaying them.
trace_recordsRILLKIT_TRACE_RECORDSFalseKeep one small entry per handler attempt in the trace key, so the dashboard can draw a trace across streams. Metadata only (ids, stream and group, consumer, node, timings, outcome); kept for an hour.
insecureRILLKIT_CONTROL_INSECUREFalseAllow a ws:// or http:// url on a host other than localhost. The API key then travels unencrypted.

Boolean variables accept 1, true, yes or on. Control.from_env(config=None, **overrides) reads the variables over the [control] section of a config file; keyword arguments win. An invalid combination raises ConfigurationError: an unknown mode, relay without a url or key, or an insecure url without insecure. relay mode needs pip install "rillkit[control]"; without it, Broker(...) raises ConfigurationError.

pythonpython
broker = Broker.from_env(control=Control(mode="relay", url="https://rillkit.example.com",
                                         api_key=os.environ["RILLKIT_API_KEY"],
                                         capture_logs=True))

ControlPlane ​

broker.control, when the control plane is on. Its threads start and stop with the broker.

MemberDescription
node_idThis node's id.
settingsThe Control.
desired(sub=None) -> DesiredWhat a subscriber (broker.subscribers[i]), or without one the node as a whole, should do now: state (RUNNING, PAUSED, MAINTENANCE or DRAINING) and concurrency, block_ms, batch_size (None means the value given in code).
hydrate() -> boolRe-reads the desired state now. True if it changed. The listener does this on every wakeup.
telemetry() -> dictThis node's TELEMETRY_REPORT: workers, key layout, and for each stream its keys, lag, pending, ack rate, lanes, state, counters, attempt timings and DLQ size.
browse(stream, group, source="stream", before=None, count=50, ids=None, after=None) -> dictA page of a stream's or DLQ's entries, newest first, with delivery statuses: what the dashboard's Messages and DLQ tabs show. Payloads are included only with inspect_messages.
trace(trace_id) -> dictOne trace's recorded attempts, oldest first, across streams: what the dashboard's trace view shows. Empty without trace_records or after an hour.
nodes() -> list[str]Ids of the nodes with a live heartbeat in this namespace.
capabilities() -> dict{"inspect_messages": ..., "capture_logs": ..., "trace_records": ...}, as announced to the server.
relayIn relay mode, the Relay client: connected is a threading.Event set while the session is up, tenant_id the tenant the server bound the key to. None otherwise.

The wire format of everything above is specified in the repository's spec/ directory: prose, JSON Schemas for every message, and conformance vectors every SDK passes.

The RillKit SDKs are released under the Apache License 2.0.