KafkaMessage
faststream.kafka.message.KafkaMessage #
KafkaMessage(
*args: Any, consumer: ConsumerProtocol, **kwargs: Any
)
Bases: StreamMessage[Union['ConsumerRecord[Any, Any]', tuple['ConsumerRecord[Any, Any]', ...]]]
Represents a Kafka message in the FastStream framework.
This class extends StreamMessage and is specialized for handling Kafka ConsumerRecord objects.
Source code in faststream/kafka/message.py
59 60 61 62 | |
raw_headers property #
raw_headers: dict[str, bytes | None]
Original header bytes, or the first message's headers for a batch.
batch_raw_headers property #
batch_raw_headers: list[dict[str, bytes | None]]
Original header bytes for every batch message; empty for a single message.
set_decoder #
set_decoder(decoder: AsyncCallable) -> None
Source code in faststream/message/message.py
69 70 | |
clear_cache #
clear_cache() -> None
Source code in faststream/message/message.py
72 73 | |
decode async #
decode() -> Optional[Any]
Serialize the message by lazy decoder.
Returns a cache after first usage. To prevent such behavior, please call message.clear_cache() after message.body changes.
Source code in faststream/message/message.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
ack async #
ack() -> None
Source code in faststream/message/message.py
117 118 119 | |
nack async #
nack() -> None
Source code in faststream/message/message.py
121 122 123 | |
reject async #
reject() -> None
Source code in faststream/message/message.py
125 126 127 | |