Record Class ProduceRecord
java.lang.Object
java.lang.Record
io.krabka.streams.columnar.ProduceRecord
- Record Components:
key- the record key bytes, or null for a keyless recordvalue- the record value bytestimestamp- the record timestamp in epoch milliseconds, or a negative value for noneheaders- the ordered Kafka headers
public record ProduceRecord(byte[] key, byte[] value, long timestamp, List<RecordHeader> headers)
extends Record
One output record from a columnar sink.
Sinks emit these through BatchCodec.encode(org.apache.arrow.vector.VectorSchemaRoot),
and ColumnarRunner.sendAsync(java.util.List, org.apache.kafka.clients.producer.Producer)
converts them to Kafka producer records. A timestamp below zero means "no
timestamp": the runner then lets the broker or producer assign one. Key and value
bytes are defensively copied in both directions.
Example
ProduceRecord output = driver.readOutput("processed-transactions");
assertThat(output.value()).isNotEmpty();
assertThat(output.headers()).contains(new RecordHeader("trace-id", traceId));
-
Constructor Summary
ConstructorsConstructorDescriptionProduceRecord(byte[] key, byte[] value, long timestamp) Creates a record without headers.ProduceRecord(byte[] key, byte[] value, long timestamp, 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.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
-
ProduceRecord
public ProduceRecord(byte[] key, byte[] value, long timestamp) 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 milliseconds, or a negative value for none
-
ProduceRecord
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 milliseconds, or a negative value for noneheaders- 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
-
headers
-