public abstract class KafkaJsonTableSource extends KafkaTableSource implements org.apache.flink.table.sources.DefinedFieldMapping
StreamTableSource
.
The version-specific Kafka consumers need to extend this class and
override KafkaTableSource.createKafkaConsumer(String, Properties, DeserializationSchema)
}.
The field names are used to parse the JSON file and so are the types.
Modifier and Type | Class and Description |
---|---|
protected static class |
KafkaJsonTableSource.Builder<T extends KafkaJsonTableSource,B extends KafkaJsonTableSource.Builder>
Abstract builder for a
KafkaJsonTableSource to be extended by builders of subclasses of
KafkaJsonTableSource. |
Modifier | Constructor and Description |
---|---|
protected |
KafkaJsonTableSource(String topic,
Properties properties,
org.apache.flink.table.api.TableSchema tableSchema,
org.apache.flink.table.api.TableSchema jsonSchema)
Creates a generic Kafka JSON
StreamTableSource . |
Modifier and Type | Method and Description |
---|---|
String |
explainSource() |
protected JsonRowDeserializationSchema |
getDeserializationSchema()
Returns the deserialization schema.
|
Map<String,String> |
getFieldMapping() |
protected void |
setFailOnMissingField(boolean failOnMissingField)
Sets the flag that specifies the behavior in case of missing fields.
|
protected void |
setFieldMapping(Map<String,String> fieldMapping)
Sets the mapping from table schema fields to JSON schema fields.
|
createKafkaConsumer, getDataStream, getKafkaConsumer, getProctimeAttribute, getReturnType, getRowtimeAttributeDescriptors, getTableSchema, setProctimeAttribute, setRowtimeAttributeDescriptors, setSpecificStartupOffsets, setStartupMode
protected KafkaJsonTableSource(String topic, Properties properties, org.apache.flink.table.api.TableSchema tableSchema, org.apache.flink.table.api.TableSchema jsonSchema)
StreamTableSource
.topic
- Kafka topic to consume.properties
- Properties for the Kafka consumer.tableSchema
- The schema of the table.jsonSchema
- The schema of the JSON messages to decode from Kafka.public Map<String,String> getFieldMapping()
getFieldMapping
in interface org.apache.flink.table.sources.DefinedFieldMapping
protected JsonRowDeserializationSchema getDeserializationSchema()
KafkaTableSource
getDeserializationSchema
in class KafkaTableSource
public String explainSource()
explainSource
in interface org.apache.flink.table.sources.TableSource<Row>
protected void setFailOnMissingField(boolean failOnMissingField)
failOnMissingField
- Flag that specifies the TableSource behavior in case of missing fields.Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.