org.apache.flink.streaming.util.serialization.DeserializationSchema Java Examples

The following examples show how to use org.apache.flink.streaming.util.serialization.DeserializationSchema. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KafkaTableSource.java    From df_data_service with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a generic Kafka {@link StreamTableSource}.
 *
 * @param topic                 Kafka topic to consume.
 * @param properties            Properties for the Kafka consumer.
 * @param deserializationSchema Deserialization schema to use for Kafka records.
 * @param fieldNames            Row field names.
 * @param fieldTypes            Row field types.
 */
KafkaTableSource(
        String topic,
        Properties properties,
        DeserializationSchema<Row> deserializationSchema,
        String[] fieldNames,
        TypeInformation<?>[] fieldTypes) {

    this.topic = Preconditions.checkNotNull(topic, "Topic");
    this.properties = Preconditions.checkNotNull(properties, "Properties");
    this.deserializationSchema = Preconditions.checkNotNull(deserializationSchema, "Deserialization schema");
    this.fieldNames = Preconditions.checkNotNull(fieldNames, "Field names");
    this.fieldTypes = Preconditions.checkNotNull(fieldTypes, "Field types");

    Preconditions.checkArgument(fieldNames.length == fieldTypes.length,
            "Number of provided field names and types does not match.");
    
    this.typeInfo = new RowTypeInfo(fieldTypes, fieldNames);
}
 
Example #2
Source File: KafkaTableSource.java    From df_data_service with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a generic Kafka {@link StreamTableSource}.
 *
 * @param topic                 Kafka topic to consume.
 * @param properties            Properties for the Kafka consumer.
 * @param deserializationSchema Deserialization schema to use for Kafka records.
 * @param typeInfo              Type information describing the result type.
 */
KafkaTableSource(
		String topic,
		Properties properties,
		DeserializationSchema<Row> deserializationSchema,
		TypeInformation<Row> typeInfo) {

	this.topic = Preconditions.checkNotNull(topic, "Topic");
	this.properties = Preconditions.checkNotNull(properties, "Properties");
	this.deserializationSchema = Preconditions.checkNotNull(deserializationSchema, "Deserialization schema");
	this.typeInfo = Preconditions.checkNotNull(typeInfo, "Type information");
	this.fieldTypes = null;
	this.fieldNames = null;
}
 
Example #3
Source File: KafkaTableSource.java    From df_data_service with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a generic Kafka {@link StreamTableSource}.
 *
 * @param topic                 Kafka topic to consume.
 * @param properties            Properties for the Kafka consumer.
 * @param deserializationSchema Deserialization schema to use for Kafka records.
 * @param fieldNames            Row field names.
 * @param fieldTypes            Row field types.
 */
KafkaTableSource(
        String topic,
        Properties properties,
        DeserializationSchema<Row> deserializationSchema,
        String[] fieldNames,
        Class<?>[] fieldTypes) {

    this(topic, properties, deserializationSchema, fieldNames, toTypeInfo(fieldTypes));
}
 
Example #4
Source File: MyKafkaJsonTableSource.java    From PoseidonX with Apache License 2.0 4 votes vote down vote up
@Override
FlinkKafkaConsumerBase<Row> getKafkaConsumer(String topic, Properties properties, DeserializationSchema<Row> deserializationSchema) {
    return new FlinkKafkaConsumer010<>(topic, deserializationSchema, properties);
}
 
Example #5
Source File: Kafka010AvroTableSource.java    From df_data_service with Apache License 2.0 4 votes vote down vote up
@Override
FlinkKafkaConsumerBase<Row> getKafkaConsumer(String topic, Properties properties, DeserializationSchema<Row> deserializationSchema) {
    return new FlinkKafkaConsumer010<>(topic, deserializationSchema, properties);
}
 
Example #6
Source File: Kafka09AvroTableSource.java    From df_data_service with Apache License 2.0 4 votes vote down vote up
@Override
FlinkKafkaConsumerBase<Row> getKafkaConsumer(String topic, Properties properties, DeserializationSchema<Row> deserializationSchema) {
    return new FlinkKafkaConsumer09<>(topic, deserializationSchema, properties);
}
 
Example #7
Source File: KafkaTableSource.java    From df_data_service with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the version-specific Kafka consumer.
 *
 * @param topic                 Kafka topic to consume.
 * @param properties            Properties for the Kafka consumer.
 * @param deserializationSchema Deserialization schema to use for Kafka records.
 * @return The version-specific Kafka consumer
 */
abstract FlinkKafkaConsumerBase<Row> getKafkaConsumer(
        String topic,
        Properties properties,
        DeserializationSchema<Row> deserializationSchema);
 
Example #8
Source File: KafkaTableSource.java    From df_data_service with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the deserialization schema.
 *
 * @return The deserialization schema
 */
protected DeserializationSchema<Row> getDeserializationSchema() {
    return deserializationSchema;
}