def decode_message_set(cls, messages): for offset, _, message in messages: if isinstance(message, kafka.protocol.message.Message) and message.is_compressed(): inner_messages = message.decompress() for (inner_offset, _msg_size, inner_msg) in inner_messages: yield kafka.structs.OffsetAndMessage(inner_offset, inner_msg) else: yield kafka.structs.OffsetAndMessage(offset, message)
def decode_message_set(cls, raw_data): messages = MessageSet.decode(raw_data, bytes_to_read=len(raw_data)) for offset, _, message in messages: if isinstance(message, kafka.protocol.message.Message) and message.is_compressed(): inner_messages = message.decompress() for (inner_offset, _msg_size, inner_msg) in inner_messages: yield kafka.structs.OffsetAndMessage(inner_offset, inner_msg) else: yield kafka.structs.OffsetAndMessage(offset, message)