AioKafkaParser
faststream.kafka.parser.AioKafkaParser #
A class to parse Kafka messages.
decode_message async
staticmethod
#
decode_message(
msg: StreamMessage[ConsumerRecord],
) -> DecodedMessage
Decodes a message.
PARAMETER | DESCRIPTION |
---|---|
msg | The message to be decoded. TYPE: |
RETURNS | DESCRIPTION |
---|---|
DecodedMessage | The decoded message. |
decode_message_batch async
classmethod
#
decode_message_batch(
msg: StreamMessage[Tuple[ConsumerRecord, ...]]
) -> List[DecodedMessage]
Decode a batch of messages.
PARAMETER | DESCRIPTION |
---|---|
msg | A stream message containing a tuple of consumer records. TYPE: |
RETURNS | DESCRIPTION |
---|---|
List[DecodedMessage] | A list of decoded messages. |
Source code in faststream/kafka/parser.py
parse_message async
staticmethod
#
parse_message(
message: ConsumerRecord,
) -> StreamMessage[ConsumerRecord]
Parses a Kafka message.
PARAMETER | DESCRIPTION |
---|---|
message | The Kafka message to parse. TYPE: |
RETURNS | DESCRIPTION |
---|---|
StreamMessage[ConsumerRecord] | A StreamMessage object representing the parsed message. |
Source code in faststream/kafka/parser.py
parse_message_batch async
staticmethod
#
parse_message_batch(
message: Tuple[ConsumerRecord, ...]
) -> KafkaMessage
Parses a batch of messages from a Kafka consumer.
PARAMETER | DESCRIPTION |
---|---|
message | A tuple of ConsumerRecord objects representing the messages to parse.
|
RETURNS | DESCRIPTION |
---|---|
KafkaMessage | A StreamMessage object containing the parsed messages. |
RAISES | DESCRIPTION |
---|---|
NotImplementedError | If any of the messages are silent (i.e., have no sound). |
Static Method
This method is a static method. It does not require an instance of the class to be called.