public class SourceRecord extends ConnectRecord<SourceRecord>
SourceRecords are generated by SourceTask
s and passed to Kafka Connect for storage in
Kafka. In addition to the standard fields in ConnectRecord
which specify where data is stored
in Kafka, they also include a sourcePartition and sourceOffset.
The sourcePartition represents a single input sourcePartition that the record came from (e.g. a filename, table name, or topic-partition). The sourceOffset represents a position in that sourcePartition which can be used to resume consumption of data.
These values can have arbitrary structure and should be represented using
org.apache.kafka.connect.data
objects (or primitive values). For example, a database connector
might specify the sourcePartition as a record containing { "db": "database_name", "table":
"table_name"} and the sourceOffset as a Long containing the timestamp of the row.
Constructor and Description |
---|
SourceRecord(Map<String,?> sourcePartition,
Map<String,?> sourceOffset,
String topic,
Integer partition,
Schema valueSchema,
Object value) |
SourceRecord(Map<String,?> sourcePartition,
Map<String,?> sourceOffset,
String topic,
Integer partition,
Schema keySchema,
Object key,
Schema valueSchema,
Object value) |
SourceRecord(Map<String,?> sourcePartition,
Map<String,?> sourceOffset,
String topic,
Integer partition,
Schema keySchema,
Object key,
Schema valueSchema,
Object value,
Long timestamp) |
SourceRecord(Map<String,?> sourcePartition,
Map<String,?> sourceOffset,
String topic,
Integer partition,
Schema keySchema,
Object key,
Schema valueSchema,
Object value,
Long timestamp,
Iterable<Header> headers) |
SourceRecord(Map<String,?> sourcePartition,
Map<String,?> sourceOffset,
String topic,
Schema valueSchema,
Object value) |
SourceRecord(Map<String,?> sourcePartition,
Map<String,?> sourceOffset,
String topic,
Schema keySchema,
Object key,
Schema valueSchema,
Object value) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
hashCode() |
SourceRecord |
newRecord(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.
|
SourceRecord |
newRecord(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.
|
Map<String,?> |
sourceOffset() |
Map<String,?> |
sourcePartition() |
String |
toString() |
headers, kafkaPartition, key, keySchema, timestamp, topic, value, valueSchema
public SourceRecord(Map<String,?> sourcePartition, Map<String,?> sourceOffset, String topic, Integer partition, Schema valueSchema, Object value)
public SourceRecord(Map<String,?> sourcePartition, Map<String,?> sourceOffset, String topic, Schema valueSchema, Object value)
public SourceRecord(Map<String,?> sourcePartition, Map<String,?> sourceOffset, String topic, Schema keySchema, Object key, Schema valueSchema, Object value)
public SourceRecord(Map<String,?> sourcePartition, Map<String,?> sourceOffset, String topic, Integer partition, Schema keySchema, Object key, Schema valueSchema, Object value)
public SourceRecord(Map<String,?> sourcePartition, Map<String,?> sourceOffset, String topic, Integer partition, Schema keySchema, Object key, Schema valueSchema, Object value, Long timestamp)
public SourceRecord newRecord(String topic, Integer kafkaPartition, Schema keySchema, Object key, Schema valueSchema, Object value, Long timestamp)
ConnectRecord
newRecord
in class ConnectRecord<SourceRecord>
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 nullpublic SourceRecord newRecord(String topic, Integer kafkaPartition, Schema keySchema, Object key, Schema valueSchema, Object value, Long timestamp, Iterable<Header> headers)
ConnectRecord
newRecord
in class ConnectRecord<SourceRecord>
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 emptypublic boolean equals(Object o)
equals
in class ConnectRecord<SourceRecord>
public int hashCode()
hashCode
in class ConnectRecord<SourceRecord>
public String toString()
toString
in class ConnectRecord<SourceRecord>