KafkaMessage
faststream.confluent.message.KafkaMessage #
KafkaMessage(
*args: Any,
consumer: ConsumerProtocol,
is_manual: bool = False,
**kwargs: Any,
)
Bases: StreamMessage[Message | tuple[Message, ...]]
Represents a Kafka message in the FastStream framework.
This class extends StreamMessage and is specialized for handling confluent_kafka.Message objects.
Source code in faststream/confluent/message.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
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.
ack async #
ack() -> None
Acknowledge the Kafka message.
Source code in faststream/confluent/message.py
79 80 81 82 83 | |
reject async #
reject() -> None
Source code in faststream/confluent/message.py
85 86 | |
nack async #
nack() -> None
Reject the Kafka message.
Source code in faststream/confluent/message.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
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 | |