Skip to content

xtr_remote_event.bundle

The xtr-dependency-injection bundle for xtr-remote-event.

RemoteEventBundle

RemoteEventBundle()

Bases: Bundle[RemoteEventConfig]

Wires declared consumers to the container, and the handler to the message bus.

Start with nothing declared.

build

build(builder: ContainerBuilder) -> None

Collect every declared consumer, and register each class as one service.

Unqualified and once, however many sources a class declared: a consumer answering for two of them is one instance answering for both, so what it remembers between events does not depend on which name the event arrived under. Each name is an alias of it under :class:ConsumerInterface, which is how the container's locator of consumers knows it by that name.

load_extension

load_extension(config: RemoteEventConfig, services: ServiceConfigurator, builder: ContainerBuilder) -> None

Register the consumer locator, and the handler that looks consumers up in it.

Both are scoped: the handler is built in the unit of the message it handles, and its locator builds a consumer in that same unit.

RemoteEventConfig dataclass

RemoteEventConfig()

What the remote event bundle builds from: nothing.

Which consumer answers for which source is declared beside each class with as_remote_event_consumer, where the code that consumes is — never in a table an application keeps in step with it by hand. That leaves this bundle with no value to take, so the type exists only to give the bundle the shape every bundle has, and to leave somewhere for a setting to go if one is ever needed.