Package org.apache.kafka.connect.sink
Class SinkRecord
- java.lang.Object
-
- org.apache.kafka.connect.connector.ConnectRecord<SinkRecord>
-
- org.apache.kafka.connect.sink.SinkRecord
-
public class SinkRecord extends ConnectRecord<SinkRecord>
SinkRecord is aConnectRecordthat has been read from Kafka and includes the kafkaOffset of the record in the Kafka topic-partition in addition to the standard fields. This information should be used by the SinkTask to coordinate kafkaOffset commits. It also includes theTimestampType, which may beTimestampType.NO_TIMESTAMP_TYPE, and the relevant timestamp, which may benull.
-
-
Constructor Summary
Constructors Constructor Description SinkRecord(String topic, int partition, Schema keySchema, Object key, Schema valueSchema, Object value, long kafkaOffset)SinkRecord(String topic, int partition, Schema keySchema, Object key, Schema valueSchema, Object value, long kafkaOffset, Long timestamp, org.apache.kafka.common.record.TimestampType timestampType)SinkRecord(String topic, int partition, Schema keySchema, Object key, Schema valueSchema, Object value, long kafkaOffset, Long timestamp, org.apache.kafka.common.record.TimestampType timestampType, Iterable<Header> headers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)inthashCode()longkafkaOffset()SinkRecordnewRecord(String topic, Integer kafkaPartition, Schema keySchema, Object key, Schema valueSchema, Object value, Long timestamp)Create a new record of the same type as itself, with the specified parameter values.SinkRecordnewRecord(String topic, Integer kafkaPartition, Schema keySchema, Object key, Schema valueSchema, Object value, Long timestamp, Iterable<Header> headers)Create a new record of the same type as itself, with the specified parameter values.org.apache.kafka.common.record.TimestampTypetimestampType()StringtoString()-
Methods inherited from class org.apache.kafka.connect.connector.ConnectRecord
headers, kafkaPartition, key, keySchema, timestamp, topic, value, valueSchema
-
-
-
-
Constructor Detail
-
SinkRecord
public SinkRecord(String topic, int partition, Schema keySchema, Object key, Schema valueSchema, Object value, long kafkaOffset)
-
SinkRecord
public SinkRecord(String topic, int partition, Schema keySchema, Object key, Schema valueSchema, Object value, long kafkaOffset, Long timestamp, org.apache.kafka.common.record.TimestampType timestampType)
-
-
Method Detail
-
kafkaOffset
public long kafkaOffset()
-
timestampType
public org.apache.kafka.common.record.TimestampType timestampType()
-
newRecord
public SinkRecord newRecord(String topic, Integer kafkaPartition, Schema keySchema, Object key, Schema valueSchema, Object value, Long timestamp)
Description copied from class:ConnectRecordCreate a new record of the same type as itself, with the specified parameter values. All other fields in this record will be copied over to the new record. Since the headers are mutable, the resulting record will have a copy of this record's headers.- Specified by:
newRecordin classConnectRecord<SinkRecord>- Parameters:
topic- the name of the topic; may be nullkafkaPartition- the partition number for the Kafka topic; may be nullkeySchema- the schema for the key; may be nullkey- the key; may be nullvalueSchema- the schema for the value; may be nullvalue- the value; may be nulltimestamp- the timestamp; may be null- Returns:
- the new record
-
newRecord
public SinkRecord newRecord(String topic, Integer kafkaPartition, Schema keySchema, Object key, Schema valueSchema, Object value, Long timestamp, Iterable<Header> headers)
Description copied from class:ConnectRecordCreate a new record of the same type as itself, with the specified parameter values. All other fields in this record will be copied over to the new record.- Specified by:
newRecordin classConnectRecord<SinkRecord>- Parameters:
topic- the name of the topic; may be nullkafkaPartition- the partition number for the Kafka topic; may be nullkeySchema- the schema for the key; may be nullkey- the key; may be nullvalueSchema- the schema for the value; may be nullvalue- the value; may be nulltimestamp- the timestamp; may be nullheaders- the headers; may be null or empty- Returns:
- the new record
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classConnectRecord<SinkRecord>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classConnectRecord<SinkRecord>
-
toString
public String toString()
- Overrides:
toStringin classConnectRecord<SinkRecord>
-
-