Class Dispatcher⚓︎
Here is the reference information for the Dispatcher class, including all its parameters, attributes, and methods.
You can import the Dispatcher class directly from the trueconf package:
trueconf.Dispatcher ⚓︎
Central dispatcher for routing incoming events.
The dispatcher receives incoming events, applies its outer middleware chain, and then passes each event to every included root router in registration order. Root routers are independent; handling an event in one root does not prevent another root from receiving it.
Each root owns an ordered tree of child routers. Within one tree, traversal stops at the first router that handles the event. A router created with allow_child_on_event=True also propagates handled events to its children.
Dispatcher inherits from Router, so it supports the same handler, middleware, and subrouter registration APIs.
FSM example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
storage | BaseStorage | None | Storage backend used to create an FSM manager. Cannot be used together with | None |
fsm_manager | FSMManager | None | Existing FSM manager instance. Cannot be used together with | None |
key_builder | KeyBuilder | None | Key builder used when creating an FSM manager from | None |
strategy | FSMStrategy | None | FSM strategy used when creating an FSM manager from | None |
Attributes:
| Name | Type | Description |
|---|---|---|
routers | List[Router] | Root routers included in the dispatcher. |
fsm | FSMManager | None | FSM manager configured for the dispatcher, or |
include_router ⚓︎
Include a root router in the dispatcher.
The dispatcher's own middleware is applied in _feed_update before the event reaches child routers. Therefore we do NOT set _parent — child routers should not inherit the dispatcher's middleware through the ancestor chain.