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
ByteBuffer
s 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 KafkaHeaders
getHeaders()
@NotNull Optional<ByteBuffer>
getKey()
@NotNull Optional<byte[]>
getKeyAsByteArray()
@NotNull Optional<Long>
getOffset()
@NotNull Optional<Integer>
getPartition()
@NotNull Optional<Long>
getTimestamp()
@NotNull String
getTopic()
@NotNull Optional<ByteBuffer>
getValue()
@NotNull Optional<byte[]>
getValueAsByteArray()
-
-
-
Method Detail
-
getHeaders
@NotNull @NotNull KafkaHeaders getHeaders()
- Returns:
- The
KafkaHeaders
of this record. These might be empty. - Since:
- 4.4.0
-
getKey
@NotNull @NotNull Optional<ByteBuffer> getKey()
- Returns:
- An
Optional
of the key of this record. - Since:
- 4.4.0
-
getKeyAsByteArray
@NotNull @NotNull Optional<byte[]> getKeyAsByteArray()
- Returns:
- An
Optional
of the key of this record. - Since:
- 4.4.0
-
getValue
@NotNull @NotNull Optional<ByteBuffer> getValue()
- Returns:
- An
Optional
of the value of this record. - Since:
- 4.4.0
-
getValueAsByteArray
@NotNull @NotNull Optional<byte[]> getValueAsByteArray()
- Returns:
- An
Optional
of the value of this record. - Since:
- 4.4.0
-
getTimestamp
@NotNull @NotNull Optional<Long> getTimestamp()
- Returns:
- An
Optional
of the timestamp of this record, in milliseconds since UNIX epoch. - Since:
- 4.4.0
-
getPartition
@NotNull @NotNull Optional<Integer> getPartition()
- Returns:
- An
Optional
of the partition number of this record. - Since:
- 4.4.0
-
-