ConsumerRecord

The object kafka-python yields for each record a consumer reads, with fields such as topic, partition, offset, key, value and headers.

In more detail

Keys and values arrive as bytes unless a deserializer is configured, so the course calls decode on them before printing. The course code names each one msg.

Example

print(msg.partition, msg.offset, msg.key.decode(), msg.value.decode())

Related terms

Taught in

References

Certification courses