Handlers¶
diffusion.handlers ¶
Base module for various event handlers.
Handler ¶
Bases: Protocol
Protocol for event handlers implementation.
handle
async
¶
Implements handling of the given event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event |
str
|
The event identifier. |
required |
**kwargs |
typing.Any
|
Additional arguments. |
{}
|
UnknownHandlerError ¶
Bases: exceptions.DiffusionError
Raised when a requested handler key has not been registered in the session.
SimpleHandler ¶
AbstractHandlerSet ¶
HandlerSet ¶
Bases: set
, AbstractHandlerSet
A collection of handlers to be invoked together.
EventStreamHandler ¶
Bases: Handler
Generic handler of event streams.
Each keyword argument is a callable which will be converted to coroutine and awaited to handle the event matching the argument keyword.
handle
async
¶
Implements handling of the given event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event |
str
|
The event identifier. |
required |
**kwargs |
typing.Any
|
Additional arguments. |
{}
|