public class SourceRecord extends ConnectRecord<SourceRecord>
SourceRecords are generated by SourceTasks 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(java.util.Map<java.lang.String,?> sourcePartition,
java.util.Map<java.lang.String,?> sourceOffset,
java.lang.String topic,
java.lang.Integer partition,
Schema valueSchema,
java.lang.Object value) |
SourceRecord(java.util.Map<java.lang.String,?> sourcePartition,
java.util.Map<java.lang.String,?> sourceOffset,
java.lang.String topic,
java.lang.Integer partition,
Schema keySchema,
java.lang.Object key,
Schema valueSchema,
java.lang.Object value) |
SourceRecord(java.util.Map<java.lang.String,?> sourcePartition,
java.util.Map<java.lang.String,?> sourceOffset,
java.lang.String topic,
java.lang.Integer partition,
Schema keySchema,
java.lang.Object key,
Schema valueSchema,
java.lang.Object value,
java.lang.Long timestamp) |
SourceRecord(java.util.Map<java.lang.String,?> sourcePartition,
java.util.Map<java.lang.String,?> sourceOffset,
java.lang.String topic,
Schema valueSchema,
java.lang.Object value) |
SourceRecord(java.util.Map<java.lang.String,?> sourcePartition,
java.util.Map<java.lang.String,?> sourceOffset,
java.lang.String topic,
Schema keySchema,
java.lang.Object key,
Schema valueSchema,
java.lang.Object value) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
SourceRecord |
newRecord(java.lang.String topic,
java.lang.Integer kafkaPartition,
Schema keySchema,
java.lang.Object key,
Schema valueSchema,
java.lang.Object value,
java.lang.Long timestamp)
Generate a new record of the same type as itself, with the specified parameter values.
|
java.util.Map<java.lang.String,?> |
sourceOffset() |
java.util.Map<java.lang.String,?> |
sourcePartition() |
java.lang.String |
toString() |
kafkaPartition, key, keySchema, timestamp, topic, value, valueSchema
public SourceRecord(java.util.Map<java.lang.String,?> sourcePartition, java.util.Map<java.lang.String,?> sourceOffset, java.lang.String topic, java.lang.Integer partition, Schema valueSchema, java.lang.Object value)
public SourceRecord(java.util.Map<java.lang.String,?> sourcePartition, java.util.Map<java.lang.String,?> sourceOffset, java.lang.String topic, Schema valueSchema, java.lang.Object value)
public SourceRecord(java.util.Map<java.lang.String,?> sourcePartition, java.util.Map<java.lang.String,?> sourceOffset, java.lang.String topic, Schema keySchema, java.lang.Object key, Schema valueSchema, java.lang.Object value)
public SourceRecord(java.util.Map<java.lang.String,?> sourcePartition, java.util.Map<java.lang.String,?> sourceOffset, java.lang.String topic, java.lang.Integer partition, Schema keySchema, java.lang.Object key, Schema valueSchema, java.lang.Object value)
public java.util.Map<java.lang.String,?> sourcePartition()
public java.util.Map<java.lang.String,?> sourceOffset()
public SourceRecord newRecord(java.lang.String topic, java.lang.Integer kafkaPartition, Schema keySchema, java.lang.Object key, Schema valueSchema, java.lang.Object value, java.lang.Long timestamp)
ConnectRecord
newRecord
in class ConnectRecord<SourceRecord>
public boolean equals(java.lang.Object o)
equals
in class ConnectRecord<SourceRecord>
public int hashCode()
hashCode
in class ConnectRecord<SourceRecord>
public java.lang.String toString()
toString
in class ConnectRecord<SourceRecord>