You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/09/11 07:54:06 UTC

[GitHub] twalthr commented on a change in pull request #6672: [FLINK-9523] [table] Add Kafka examples for Flink Table/SQL API

twalthr commented on a change in pull request #6672: [FLINK-9523] [table] Add Kafka examples for Flink Table/SQL API
URL: https://github.com/apache/flink/pull/6672#discussion_r216575925
 
 

 ##########
 File path: flink-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/kafka/Kafka010JsonConsumer.java
 ##########
 @@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.examples.java.kafka;
+
+import org.apache.flink.api.common.typeinfo.Types;
+import org.apache.flink.api.java.utils.ParameterTool;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+import org.apache.flink.streaming.connectors.kafka.Kafka010JsonTableSink;
+import org.apache.flink.streaming.connectors.kafka.Kafka010JsonTableSource;
+import org.apache.flink.table.api.StreamTableEnvironment;
+import org.apache.flink.table.api.Table;
+import org.apache.flink.table.api.TableSchema;
+
+/**
+ * An example that shows how to read from and write to Kafka table rows as JSON-encoded records.
+ *
+ * <p>This example shows how to:
+ *  - Use Kafka JSON TableSource
+ *  - Use SQL api and a group window to compute a result
+ *
+ * <p>Example usage:
+ * Run Consumer with the following arguments:
+ * 	--input-topic consumer-input --output-topic consumer-output --bootstrap.servers localhost:9092 --zookeeper.connect localhost:2181 --group.id myconsumer
+ */
+public class Kafka010JsonConsumer {
 
 Review comment:
   I would call the classes `Kafka010JsonExample` to differentiate from actual consumer/producer classes.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services