def unpack(self, packed_message):
"""Decodes a message packed with :func:`pack`.
Warning:
The public API for this function may change to return
:class:`data_pipeline.message.Message` instances.
Args:
packed_message (bytes): The previously packed message
Returns:
dict: A dictionary with the decoded Avro representation.
"""
# If the magic byte is ASCII_MAGIC_BYTE, decode it from base64 to ASCII
if packed_message[0] == self.ASCII_MAGIC_BYTE:
packed_message = base64.urlsafe_b64decode(packed_message[1:])
return self._avro_string_reader.decode(packed_message[1:])
评论列表
文章目录