Interface KafkaRecord
-
@Immutable @DoNotImplement public interface KafkaRecord
Represents a Kafka record, that was either read from or should be written to a Kafka cluster.The internal state of this interface is completely immutable. All returned
ByteBuffers are read only and a deep copy of anybyte[]is made for every method call returning one.- Since:
- 4.4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull KafkaHeadersgetHeaders()@NotNull Optional<ByteBuffer>getKey()@NotNull Optional<byte[]>getKeyAsByteArray()@NotNull Optional<Long>getOffset()@NotNull Optional<Integer>getPartition()@NotNull Optional<Long>getTimestamp()@NotNull StringgetTopic()@NotNull Optional<ByteBuffer>getValue()@NotNull Optional<byte[]>getValueAsByteArray()
-
-
-
Method Detail
-
getHeaders
@NotNull @NotNull KafkaHeaders getHeaders()
- Returns:
- the
KafkaHeadersof this record. These might be empty. - Since:
- 4.4.0
-
getKey
@NotNull @NotNull Optional<ByteBuffer> getKey()
- Returns:
- an
Optionalof the key of this record. - Since:
- 4.4.0
-
getKeyAsByteArray
@NotNull @NotNull Optional<byte[]> getKeyAsByteArray()
- Returns:
- an
Optionalof the key of this record. - Since:
- 4.4.0
-
getValue
@NotNull @NotNull Optional<ByteBuffer> getValue()
- Returns:
- an
Optionalof the value of this record. - Since:
- 4.4.0
-
getValueAsByteArray
@NotNull @NotNull Optional<byte[]> getValueAsByteArray()
- Returns:
- an
Optionalof the value of this record.@return - Since:
- 4.4.0
-
getTimestamp
@NotNull @NotNull Optional<Long> getTimestamp()
- Returns:
- an
Optionalof the timestamp of this record, in milliseconds since UNIX epoch. - Since:
- 4.4.0
-
getPartition
@NotNull @NotNull Optional<Integer> getPartition()
- Returns:
- an
Optionalof the partition number of this record. - Since:
- 4.4.0
-
-