LogicPublisher
faststream.kafka.publisher.LogicPublisher dataclass
#
Bases: ABCPublisher[ConsumerRecord]
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/kafka/publisher.py
reset_test #
schema #
Returns the schema of the API operation as a dictionary of channel names and channel objects.