Record Class ConsumedRecord
java.lang.Object
java.lang.Record
io.krabka.streams.columnar.ConsumedRecord
- Record Components:
key- the record key bytes, or null for a keyless recordvalue- the record value bytestimestamp- the record timestamp in epoch millisecondspartition- the source partition numberoffset- the record offset within the partitionheaders- the ordered Kafka headers
public record ConsumedRecord(byte[] key, byte[] value, long timestamp, int partition, long offset, List<RecordHeader> headers)
extends Record
One input record in a partition batch.
This is the broker-independent form of a fetched Kafka record: the runner and
the test driver both build it, and BatchCodec.decode(java.util.List) turns a
list of them into one Arrow batch. Key and value bytes are defensively copied in
both directions, so a record can be shared freely between tests and threads.
Example
var record = new ConsumedRecord(key, arrowIpcBytes, 1_700_000_000_000L, 0, 42L);
try (var batch = codec.decode("transactions", List.of(record))) {
// process the batch
}
-
Constructor Summary
ConstructorsConstructorDescriptionConsumedRecord(byte[] key, byte[] value, long timestamp, int partition, long offset) Creates a record without headers.ConsumedRecord(byte[] key, byte[] value, long timestamp, int partition, long offset, List<RecordHeader> headers) Copies the mutable components so the record is immutable. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.headers()Returns the value of theheadersrecord component.byte[]key()Returns a copy of the record key.longoffset()Returns the value of theoffsetrecord component.intReturns the value of thepartitionrecord component.longReturns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.byte[]value()Returns a copy of the record value.
-
Constructor Details
-
ConsumedRecord
public ConsumedRecord(byte[] key, byte[] value, long timestamp, int partition, long offset) Creates a record without headers.- Parameters:
key- the record key bytes, or null for a keyless recordvalue- the record value bytestimestamp- the record timestamp in epoch millisecondspartition- the source partition numberoffset- the record offset within the partition
-
ConsumedRecord
public ConsumedRecord(byte[] key, byte[] value, long timestamp, int partition, long offset, List<RecordHeader> headers) Copies the mutable components so the record is immutable.- Parameters:
key- the record key bytes, or null for a keyless recordvalue- the record value bytestimestamp- the record timestamp in epoch millisecondspartition- the source partition numberoffset- the record offset within the partitionheaders- the ordered Kafka headers
-
-
Method Details
-
key
public byte[] key()Returns a copy of the record key.- Returns:
- a fresh copy of the key bytes, or null for a keyless record
-
value
public byte[] value()Returns a copy of the record value.- Returns:
- a fresh copy of the value bytes
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
timestamp
-
partition
-
offset
-
headers
-