BasePublisher
faststream.broker.publisher.BasePublisher dataclass #
Bases: AsyncAPIOperation, Generic[MsgType]
A base class for publishers in an asynchronous API.
| METHOD | DESCRIPTION |
|---|---|
description | returns the description of the publisher |
__call__ | decorator to register a function as a handler for the publisher |
publish | publishes a message with optional correlation ID |
| RAISES | DESCRIPTION |
|---|---|
NotImplementedError | if the publish method is not implemented. |
Note
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
calls class-attribute instance-attribute #
mock class-attribute instance-attribute #
get_payloads #
Source code in faststream/broker/publisher.py
name #
publish abstractmethod async #
publish(
message: SendableMessage,
correlation_id: Optional[str] = None,
**kwargs: Any
) -> Optional[SendableMessage]
Publish a message.
| PARAMETER | DESCRIPTION |
|---|---|
message | The message to be published. TYPE: |
correlation_id | Optional correlation ID for the message. |
**kwargs | Additional keyword arguments. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Optional[SendableMessage] | The published 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)
Source code in faststream/broker/publisher.py
reset_test #
schema #
Last update: 2023-11-13