LogicPublisher
faststream.confluent.publisher.LogicPublisher dataclass
#
LogicPublisher(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: ABCPublisher[Message]
A class to publish messages to a Kafka topic.
METHOD | DESCRIPTION |
---|---|
publish | Publishes messages to the Kafka topic |
RAISES | DESCRIPTION |
---|---|
AssertionError | If |
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 |
Source code in faststream/confluent/publisher.py
reset_test #
schema #
Returns the schema of the API operation as a dictionary of channel names and channel objects.