Publisher
faststream.kafka.asyncapi.Publisher dataclass
#
Publisher(include_in_schema: bool = True, title: Optional[str] = None, _description: Optional[str] = None, _schema: Optional[Any] = None, _fake_handler: bool = False, topic: str = '', key: Optional[bytes] = None, partition: Optional[int] = None, timestamp_ms: Optional[int] = None, headers: Optional[Dict[str, str]] = None, reply_to: Optional[str] = '', batch: bool = False, client_id: str = 'faststream-' + __version__)
Bases: LogicPublisher
, AsyncAPIOperation
A class representing a publisher.
METHOD | DESCRIPTION |
---|---|
schema | returns the schema for the publisher |
RAISES | DESCRIPTION |
---|---|
NotImplementedError | If silent animals are not supported |
calls class-attribute
instance-attribute
#
client_id class-attribute
instance-attribute
#
include_in_schema class-attribute
instance-attribute
#
mock class-attribute
instance-attribute
#
get_payloads #
Source code in faststream/broker/publisher.py
publish async
#
publish(*messages: SendableMessage, message: SendableMessage = '', key: Optional[bytes] = None, partition: Optional[int] = None, timestamp_ms: Optional[int] = None, headers: Optional[Dict[str, str]] = None, correlation_id: Optional[str] = None) -> None
Publish messages to a topic.
PARAMETER | DESCRIPTION |
---|---|
*messages | Variable length argument list of SendableMessage objects. TYPE: |
message | A SendableMessage object. Default is an empty string. TYPE: |
key | Optional bytes object representing the message key. |
partition | Optional integer representing the partition to publish the message to. |
timestamp_ms | Optional integer representing the timestamp of the message in milliseconds. |
headers | Optional dictionary of header key-value pairs. |
correlation_id | Optional string representing the correlation ID of the message. |
RETURNS | DESCRIPTION |
---|---|
None | None |
RAISES | DESCRIPTION |
---|---|
AssertionError | If |
AssertionError | If |
ValueError | If |