Skip to main content
Version: 0.8.0

EventMetadata

fastkafka.EventMetadata

View source

A class for encapsulating Kafka record metadata.

Parameters:

NameTypeDescriptionDefault
topicstrThe topic this record is received fromrequired
partitionintThe partition from which this record is receivedrequired
offsetintThe position of this record in the corresponding Kafka partitionrequired
timestampintThe timestamp of this recordrequired
timestamp_typeintThe timestamp type of this recordrequired
keyOptional[bytes]The key (or None if no key is specified)required
valueOptional[bytes]The valuerequired
serialized_key_sizeintThe size of the serialized, uncompressed key in bytesrequired
serialized_value_sizeintThe size of the serialized, uncompressed value in bytesrequired
headersSequence[Tuple[str, bytes]]The headersrequired

create_event_metadata

View source
@staticmethod
create_event_metadata(
record
)

Creates an instance of EventMetadata from a ConsumerRecord.

Parameters:

NameTypeDescriptionDefault
recordConsumerRecordThe Kafka ConsumerRecord.required

Returns:

TypeDescription
EventMetadataThe created EventMetadata instance.