Package com.jprofiler.api.agent
Interface KafkaProducerRecord
public interface KafkaProducerRecord
Represents a proxy to a Kafka
ProducerRecord combined with selected data from RecordMetadata.
Provides access to details about the topic, partition, key, value, and metadata related to the Kafka record.
Acts as an abstraction layer to work with Kafka ProducerRecord objects and their associated metadata.-
Method Summary
Modifier and TypeMethodDescriptionkey()Gets the deserialized key of the record.byte[]lastHeaderValue(String key) Gets the value of the last header with the specified key from the record’s headers.metadata()Gets the underlying metadata represented by this proxy.intGets the partition to which the record was sent from the records' metadata.Gets the underlying producer record represented by this proxy.intGets the size of the serialized key, in bytes.intGets the size of the serialized value, in bytes.topic()Gets the topic to which the record is sent.value()Gets the deserialized value of the record.
-
Method Details
-
topic
String topic()Gets the topic to which the record is sent.- Returns:
- the name of the Kafka topic.
-
partition
int partition()Gets the partition to which the record was sent from the records' metadata.- Returns:
- the partition ID
-
lastHeaderValue
Gets the value of the last header with the specified key from the record’s headers.- Parameters:
key- the key of the desired header.- Returns:
- the value of the last header with the given key as a byte array,
or
nullif the header does not exist.
-
key
Object key()Gets the deserialized key of the record.- Returns:
- the key of the record, or
nullif no key is present.
-
value
Object value()Gets the deserialized value of the record.- Returns:
- the value of the record, or
nullif no value is present.
-
serializedKeySize
int serializedKeySize()Gets the size of the serialized key, in bytes.- Returns:
- the size of the serialized key, or
-1if the key is not present.
-
serializedValueSize
int serializedValueSize()Gets the size of the serialized value, in bytes.- Returns:
- the size of the serialized value, or
-1if the value is not present.
-
producerRecord
Object producerRecord()Gets the underlying producer record represented by this proxy. This method returns the original KafkaProducerRecordobject.- Returns:
- the original producer record
-
metadata
Object metadata()Gets the underlying metadata represented by this proxy. This method returns the original KafkaRecordMetadataobject.- Returns:
- the original metadata
-