Record Class KafkaRecordKey
java.lang.Object
java.lang.Record
io.aiven.kafka.connect.amqp.common.KafkaRecordKey
- Record Components:
topic- the original topic.partition- the original partition.offset- the original offset.
- All Implemented Interfaces:
Comparable<KafkaRecordKey>
public record KafkaRecordKey(String topic, int partition, long offset)
extends Record
implements Comparable<KafkaRecordKey>
A record that is used to track offsets from Kafka. Generally used in maps to track source or sink
records.
-
Constructor Summary
ConstructorsConstructorDescriptionKafkaRecordKey(String topic, int partition, long offset) Creates an instance of aKafkaRecordKeyrecord class.KafkaRecordKey(org.apache.kafka.clients.producer.RecordMetadata recordMetadata) Creates an instance from a RecordMetadata instance.KafkaRecordKey(org.apache.kafka.common.TopicPartition topicPartition, long offset) Creates an instance from a TopicPartition object and an offset.KafkaRecordKey(org.apache.kafka.connect.sink.SinkRecord sinkRecord) Creates an instance from a SinkRecord. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(KafkaRecordKey that) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longoffset()Returns the value of theoffsetrecord component.intReturns the value of thepartitionrecord component.topic()Returns the value of thetopicrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
KafkaRecordKey
public KafkaRecordKey(org.apache.kafka.connect.sink.SinkRecord sinkRecord) Creates an instance from a SinkRecord.- Parameters:
sinkRecord- the sink record to extract data from.
-
KafkaRecordKey
public KafkaRecordKey(org.apache.kafka.clients.producer.RecordMetadata recordMetadata) Creates an instance from a RecordMetadata instance.- Parameters:
recordMetadata- the record metadata to extract data from.
-
KafkaRecordKey
public KafkaRecordKey(org.apache.kafka.common.TopicPartition topicPartition, long offset) Creates an instance from a TopicPartition object and an offset.- Parameters:
topicPartition- the TopicPartition to use.offset- the offset.
-
KafkaRecordKey
Creates an instance of aKafkaRecordKeyrecord class.
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<KafkaRecordKey>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 '=='. -
topic
Returns the value of thetopicrecord component.- Returns:
- the value of the
topicrecord component
-
partition
public int partition()Returns the value of thepartitionrecord component.- Returns:
- the value of the
partitionrecord component
-
offset
public long offset()Returns the value of theoffsetrecord component.- Returns:
- the value of the
offsetrecord component
-