remotivelabs.topology.namespaces.namespace_client
class
NamespaceClient:
A NamespaceClient is used to interact with one or more namespaces on RemotiveBroker.
It manages lifecycle operations for namespaces (e.g., CanNamespace
, SomeIPNamespace
) and handles inputs.
NamespaceClient( broker_client: remotivelabs.broker.BrokerClient, namespaces: list[remotivelabs.topology.namespaces.namespace.Namespace] | None = None, input_handlers: list[tuple[str, remotivelabs.topology.namespaces.input_handlers.InputHandler]] | None = None)
Initialize the NamespaceClient instance.
Arguments:
- broker_client: The client used for communication with the broker.
- namespaces: list of Namespace instances (
CanNamespace
,SomeIPNamespace
, etc.). - input_handlers: Optional list of (namespace, handler list) pairs to receive
callbacks on inputs.
It is advised to create these using the namespace's
create_input_handler
method.
Note:
Start the instance using a context manager:
async with NamespaceClient(...) as client: ... await client.run_forever()
Or use the start/stop methods directly:
client = NamespaceClient(...) await client.start() # ... await client.stop()
async def
start(self) -> None:
Start the NamespaceClient, open all namespaces, and initialize input handlers. This is an idempotent operation - calling it multiple times has no additional effect.