BaseHandler
faststream.broker.handler.BaseHandler #
BaseHandler(
*,
log_context_builder: Callable[
[StreamMessage[Any]], Dict[str, str]
],
description: Optional[str] = None,
title: Optional[str] = None
)
Bases: AsyncAPIOperation
, Generic[MsgType]
A base handler class for asynchronous API operations.
METHOD | DESCRIPTION |
---|---|
__init__ | Initializes the BaseHandler object. |
name | Returns the name of the handler. |
call_name | Returns the name of the handler call. |
description | Returns the description of the handler. |
consume | Abstract method to consume a message. |
Note: This class inherits from AsyncAPIOperation and is a generic class with type parameter MsgType.
Note
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
Initialize a new instance of the class.
PARAMETER | DESCRIPTION |
---|---|
description | Optional description of the instance. |
title | Optional title of the instance. |
Note
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
Source code in faststream/broker/handler.py
calls instance-attribute
#
calls: Union[
List[
Tuple[
HandlerCallWrapper[
MsgType, Any, SendableMessage
],
Callable[[StreamMessage[MsgType]], bool],
SyncParser[MsgType, StreamMessage[MsgType]],
SyncDecoder[StreamMessage[MsgType]],
Sequence[Callable[[Any], BaseMiddleware]],
CallModel[Any, SendableMessage],
]
],
List[
Tuple[
HandlerCallWrapper[
MsgType, Any, SendableMessage
],
Callable[
[StreamMessage[MsgType]], Awaitable[bool]
],
AsyncParser[MsgType, StreamMessage[MsgType]],
AsyncDecoder[StreamMessage[MsgType]],
Sequence[Callable[[Any], BaseMiddleware]],
CallModel[Any, SendableMessage],
]
],
] = []
global_middlewares instance-attribute
#
consume abstractmethod
#
Consume a message.
PARAMETER | DESCRIPTION |
---|---|
msg | The message to be consumed. TYPE: |
RETURNS | DESCRIPTION |
---|---|
SendableMessage | The sendable message. |
RAISES | DESCRIPTION |
---|---|
NotImplementedError | If the method is not implemented. |
Note
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)