T
- Type of the KafkaTableSource produced by the builder.B
- Type of the KafkaTableSource.Builder subclass.protected abstract static class KafkaTableSource.Builder<T extends KafkaTableSource,B extends KafkaTableSource.Builder> extends Object
KafkaTableSource
to be extended by builders of subclasses of
KafkaTableSource.Modifier | Constructor and Description |
---|---|
protected |
Builder() |
Modifier and Type | Method and Description |
---|---|
protected abstract KafkaTableSource |
build()
Builds the configured
KafkaTableSource . |
protected abstract B |
builder()
Returns the builder.
|
protected void |
configureTableSource(T tableSource)
Configures a TableSource with optional parameters.
|
B |
forTopic(String topic)
Sets the topic from which the table is read.
|
B |
fromEarliest()
Configures the TableSource to start reading from the earliest offset for all partitions.
|
B |
fromGroupOffsets()
Configures the TableSource to start reading from any committed group offsets found in Zookeeper / Kafka brokers.
|
B |
fromLatest()
Configures the TableSource to start reading from the latest offset for all partitions.
|
B |
fromSpecificOffsets(Map<KafkaTopicPartition,Long> specificStartupOffsets)
Configures the TableSource to start reading partitions from specific offsets, set independently for each partition.
|
protected Properties |
getKafkaProps()
Returns the configured Kafka properties.
|
protected org.apache.flink.table.api.TableSchema |
getTableSchema()
Returns the configured table schema.
|
protected String |
getTopic()
Returns the configured topic.
|
protected abstract boolean |
supportsKafkaTimestamps()
True if the KafkaSource supports Kafka timestamps, false otherwise.
|
B |
withKafkaProperties(Properties props)
Sets the configuration properties for the Kafka consumer.
|
B |
withKafkaTimestampAsRowtimeAttribute(String rowtimeAttribute,
org.apache.flink.table.sources.wmstrategies.WatermarkStrategy watermarkStrategy)
Configures the Kafka timestamp to be a rowtime attribute.
|
B |
withProctimeAttribute(String proctimeAttribute)
Configures a field of the table to be a processing time attribute.
|
B |
withRowtimeAttribute(String rowtimeAttribute,
org.apache.flink.table.sources.tsextractors.TimestampExtractor timestampExtractor,
org.apache.flink.table.sources.wmstrategies.WatermarkStrategy watermarkStrategy)
Configures a field of the table to be a rowtime attribute.
|
B |
withSchema(org.apache.flink.table.api.TableSchema schema)
Sets the schema of the produced table.
|
public B forTopic(String topic)
topic
- The topic from which the table is read.public B withKafkaProperties(Properties props)
props
- The configuration properties for the Kafka consumer.public B withSchema(org.apache.flink.table.api.TableSchema schema)
schema
- The schema of the produced table.public B withProctimeAttribute(String proctimeAttribute)
Types.SQL_TIMESTAMP()
.proctimeAttribute
- The name of the processing time attribute in the table schema.public B withRowtimeAttribute(String rowtimeAttribute, org.apache.flink.table.sources.tsextractors.TimestampExtractor timestampExtractor, org.apache.flink.table.sources.wmstrategies.WatermarkStrategy watermarkStrategy)
Types.SQL_TIMESTAMP()
.rowtimeAttribute
- The name of the rowtime attribute in the table schema.timestampExtractor
- The TimestampExtractor
to extract the rowtime attribute from the physical type.watermarkStrategy
- The WatermarkStrategy
to generate watermarks for the rowtime attribute.public B withKafkaTimestampAsRowtimeAttribute(String rowtimeAttribute, org.apache.flink.table.sources.wmstrategies.WatermarkStrategy watermarkStrategy)
Note: Kafka supports message timestamps only since version 0.10.
rowtimeAttribute
- The name of the rowtime attribute in the table schema.watermarkStrategy
- The WatermarkStrategy
to generate watermarks for the rowtime attribute.public B fromEarliest()
public B fromLatest()
public B fromGroupOffsets()
public B fromSpecificOffsets(Map<KafkaTopicPartition,Long> specificStartupOffsets)
specificStartupOffsets
- the specified offsets for partitionsFlinkKafkaConsumerBase.setStartFromSpecificOffsets(Map)
protected String getTopic()
protected Properties getKafkaProps()
protected org.apache.flink.table.api.TableSchema getTableSchema()
protected abstract boolean supportsKafkaTimestamps()
protected void configureTableSource(T tableSource)
tableSource
- The TableSource to configure.protected abstract B builder()
protected abstract KafkaTableSource build()
KafkaTableSource
.KafkaTableSource
.Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.