You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/01/16 07:53:47 UTC
[GitHub] [iotdb] Alibaba-HZY opened a new pull request #4849: [IOTDB-2184]Update the code of Kafka example to use Session API and u…
Alibaba-HZY opened a new pull request #4849:
URL: https://github.com/apache/iotdb/pull/4849
[IOTDB-2184]Update the code of Kafka example to use Session API and update kafka version from 0.8.2.0 to 2.8.0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Alibaba-HZY commented on a change in pull request #4849: [IOTDB-2184]Update the code of Kafka example to use Session API and u…
Posted by GitBox <gi...@apache.org>.
Alibaba-HZY commented on a change in pull request #4849:
URL: https://github.com/apache/iotdb/pull/4849#discussion_r785610366
##########
File path: example/kafka/src/main/java/org/apache/iotdb/kafka/ConsumerThread.java
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.iotdb.kafka;
+
+import org.apache.iotdb.rpc.IoTDBConnectionException;
+import org.apache.iotdb.rpc.StatementExecutionException;
+import org.apache.iotdb.session.Session;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+
+import org.apache.kafka.clients.consumer.ConsumerRecord;
+import org.apache.kafka.clients.consumer.ConsumerRecords;
+import org.apache.kafka.clients.consumer.KafkaConsumer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/** The class is Thread class of Consumer. ConsumerThread. */
+public class ConsumerThread implements Runnable {
+
+ private static final Logger logger = LoggerFactory.getLogger(ConsumerThread.class);
+ private KafkaConsumer<String, String> consumer;
+
+ public ConsumerThread(KafkaConsumer<String, String> consumer) {
+ this.consumer = consumer;
+ }
+
+ /** insert data to IoTDB */
+ private void insert(Session session, String data)
+ throws IoTDBConnectionException, StatementExecutionException {
+ String[] dataArray = data.split(",");
+ String device = dataArray[0];
+ long time = Long.parseLong(dataArray[1]);
+ List<String> measurements = Arrays.asList(dataArray[2].split(":"));
+ List<TSDataType> types = new ArrayList<>();
+ for (String type : dataArray[3].split(":")) {
+ types.add(TSDataType.valueOf(type));
+ }
+
+ List<Object> values = new ArrayList<>();
+ String[] valuesStr = dataArray[4].split(":");
+ for (int i = 0; i < valuesStr.length; i++) {
+ switch (types.get(i)) {
+ case INT64:
+ values.add(Long.parseLong(valuesStr[i]));
+ break;
+ case DOUBLE:
+ values.add(Double.parseDouble(valuesStr[i]));
+ break;
+ case INT32:
+ values.add(Integer.parseInt(valuesStr[i]));
+ break;
+ case TEXT:
+ values.add(valuesStr[i]);
+ break;
+ case FLOAT:
+ values.add(Float.parseFloat(valuesStr[i]));
+ break;
+ case BOOLEAN:
+ values.add(Boolean.parseBoolean(valuesStr[i]));
+ break;
+ }
+ }
+
+ session.insertRecord(device, time, measurements, types, values);
+ }
+
+ @Override
+ public void run() {
+ try {
+ do {
+ ConsumerRecords<String, String> records = consumer.poll(Duration.ofSeconds(1));
+ Session session =
Review comment:
ok,i will use SessionPool
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] wangchao316 commented on a change in pull request #4849: [IOTDB-2184]Update the code of Kafka example to use Session API and u…
Posted by GitBox <gi...@apache.org>.
wangchao316 commented on a change in pull request #4849:
URL: https://github.com/apache/iotdb/pull/4849#discussion_r785592984
##########
File path: example/kafka/src/main/java/org/apache/iotdb/kafka/Consumer.java
##########
@@ -0,0 +1,123 @@
+/*
+ * 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.iotdb.kafka;
+
+import org.apache.iotdb.rpc.IoTDBConnectionException;
+import org.apache.iotdb.rpc.StatementExecutionException;
+import org.apache.iotdb.session.Session;
+import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
+
+import org.apache.kafka.clients.consumer.ConsumerConfig;
+import org.apache.kafka.clients.consumer.KafkaConsumer;
+import org.apache.kafka.common.serialization.StringDeserializer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
Review comment:
Good Job.
I have a little ...... does not use import *
##########
File path: example/kafka/src/main/java/org/apache/iotdb/kafka/ConsumerThread.java
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.iotdb.kafka;
+
+import org.apache.iotdb.rpc.IoTDBConnectionException;
+import org.apache.iotdb.rpc.StatementExecutionException;
+import org.apache.iotdb.session.Session;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+
+import org.apache.kafka.clients.consumer.ConsumerRecord;
+import org.apache.kafka.clients.consumer.ConsumerRecords;
+import org.apache.kafka.clients.consumer.KafkaConsumer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/** The class is Thread class of Consumer. ConsumerThread. */
+public class ConsumerThread implements Runnable {
+
+ private static final Logger logger = LoggerFactory.getLogger(ConsumerThread.class);
+ private KafkaConsumer<String, String> consumer;
+
+ public ConsumerThread(KafkaConsumer<String, String> consumer) {
+ this.consumer = consumer;
+ }
+
+ /** insert data to IoTDB */
+ private void insert(Session session, String data)
+ throws IoTDBConnectionException, StatementExecutionException {
+ String[] dataArray = data.split(",");
+ String device = dataArray[0];
+ long time = Long.parseLong(dataArray[1]);
+ List<String> measurements = Arrays.asList(dataArray[2].split(":"));
+ List<TSDataType> types = new ArrayList<>();
+ for (String type : dataArray[3].split(":")) {
+ types.add(TSDataType.valueOf(type));
+ }
+
+ List<Object> values = new ArrayList<>();
+ String[] valuesStr = dataArray[4].split(":");
+ for (int i = 0; i < valuesStr.length; i++) {
+ switch (types.get(i)) {
+ case INT64:
+ values.add(Long.parseLong(valuesStr[i]));
+ break;
+ case DOUBLE:
+ values.add(Double.parseDouble(valuesStr[i]));
+ break;
+ case INT32:
+ values.add(Integer.parseInt(valuesStr[i]));
+ break;
+ case TEXT:
+ values.add(valuesStr[i]);
+ break;
+ case FLOAT:
+ values.add(Float.parseFloat(valuesStr[i]));
+ break;
+ case BOOLEAN:
+ values.add(Boolean.parseBoolean(valuesStr[i]));
+ break;
+ }
+ }
+
+ session.insertRecord(device, time, measurements, types, values);
+ }
+
+ @Override
+ public void run() {
+ try {
+ do {
+ ConsumerRecords<String, String> records = consumer.poll(Duration.ofSeconds(1));
+ Session session =
+ new Session(
+ Constant.IOTDB_CONNECTION_HOST,
+ Constant.IOTDB_CONNECTION_PORT,
+ Constant.IOTDB_CONNECTION_USER,
+ Constant.IOTDB_CONNECTION_PASSWORD);
+ session.open();
+ for (ConsumerRecord<String, String> record : records) {
+ insert(session, record.value());
+ }
+ } while (true);
+ } catch (Exception e) {
+ logger.error(e.getMessage());
Review comment:
When is the session closed?
If an exception occurs, do you want to close it?
##########
File path: example/kafka/src/main/java/org/apache/iotdb/kafka/ConsumerThread.java
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.iotdb.kafka;
+
+import org.apache.iotdb.rpc.IoTDBConnectionException;
+import org.apache.iotdb.rpc.StatementExecutionException;
+import org.apache.iotdb.session.Session;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+
+import org.apache.kafka.clients.consumer.ConsumerRecord;
+import org.apache.kafka.clients.consumer.ConsumerRecords;
+import org.apache.kafka.clients.consumer.KafkaConsumer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/** The class is Thread class of Consumer. ConsumerThread. */
+public class ConsumerThread implements Runnable {
+
+ private static final Logger logger = LoggerFactory.getLogger(ConsumerThread.class);
+ private KafkaConsumer<String, String> consumer;
+
+ public ConsumerThread(KafkaConsumer<String, String> consumer) {
+ this.consumer = consumer;
+ }
+
+ /** insert data to IoTDB */
+ private void insert(Session session, String data)
+ throws IoTDBConnectionException, StatementExecutionException {
+ String[] dataArray = data.split(",");
+ String device = dataArray[0];
+ long time = Long.parseLong(dataArray[1]);
+ List<String> measurements = Arrays.asList(dataArray[2].split(":"));
+ List<TSDataType> types = new ArrayList<>();
+ for (String type : dataArray[3].split(":")) {
+ types.add(TSDataType.valueOf(type));
+ }
+
+ List<Object> values = new ArrayList<>();
+ String[] valuesStr = dataArray[4].split(":");
+ for (int i = 0; i < valuesStr.length; i++) {
+ switch (types.get(i)) {
+ case INT64:
+ values.add(Long.parseLong(valuesStr[i]));
+ break;
+ case DOUBLE:
+ values.add(Double.parseDouble(valuesStr[i]));
+ break;
+ case INT32:
+ values.add(Integer.parseInt(valuesStr[i]));
+ break;
+ case TEXT:
+ values.add(valuesStr[i]);
+ break;
+ case FLOAT:
+ values.add(Float.parseFloat(valuesStr[i]));
+ break;
+ case BOOLEAN:
+ values.add(Boolean.parseBoolean(valuesStr[i]));
+ break;
+ }
+ }
+
+ session.insertRecord(device, time, measurements, types, values);
Review comment:
You are advised to use the session API and insertRecords, or insertTablets to insert data.This allows you to get the most out of write performance
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] wangchao316 commented on a change in pull request #4849: [IOTDB-2184]Update the code of Kafka example to use Session API and u…
Posted by GitBox <gi...@apache.org>.
wangchao316 commented on a change in pull request #4849:
URL: https://github.com/apache/iotdb/pull/4849#discussion_r785602444
##########
File path: example/kafka/src/main/java/org/apache/iotdb/kafka/ConsumerThread.java
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.iotdb.kafka;
+
+import org.apache.iotdb.rpc.IoTDBConnectionException;
+import org.apache.iotdb.rpc.StatementExecutionException;
+import org.apache.iotdb.session.Session;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+
+import org.apache.kafka.clients.consumer.ConsumerRecord;
+import org.apache.kafka.clients.consumer.ConsumerRecords;
+import org.apache.kafka.clients.consumer.KafkaConsumer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/** The class is Thread class of Consumer. ConsumerThread. */
+public class ConsumerThread implements Runnable {
+
+ private static final Logger logger = LoggerFactory.getLogger(ConsumerThread.class);
+ private KafkaConsumer<String, String> consumer;
+
+ public ConsumerThread(KafkaConsumer<String, String> consumer) {
+ this.consumer = consumer;
+ }
+
+ /** insert data to IoTDB */
+ private void insert(Session session, String data)
+ throws IoTDBConnectionException, StatementExecutionException {
+ String[] dataArray = data.split(",");
+ String device = dataArray[0];
+ long time = Long.parseLong(dataArray[1]);
+ List<String> measurements = Arrays.asList(dataArray[2].split(":"));
+ List<TSDataType> types = new ArrayList<>();
+ for (String type : dataArray[3].split(":")) {
+ types.add(TSDataType.valueOf(type));
+ }
+
+ List<Object> values = new ArrayList<>();
+ String[] valuesStr = dataArray[4].split(":");
+ for (int i = 0; i < valuesStr.length; i++) {
+ switch (types.get(i)) {
+ case INT64:
+ values.add(Long.parseLong(valuesStr[i]));
+ break;
+ case DOUBLE:
+ values.add(Double.parseDouble(valuesStr[i]));
+ break;
+ case INT32:
+ values.add(Integer.parseInt(valuesStr[i]));
+ break;
+ case TEXT:
+ values.add(valuesStr[i]);
+ break;
+ case FLOAT:
+ values.add(Float.parseFloat(valuesStr[i]));
+ break;
+ case BOOLEAN:
+ values.add(Boolean.parseBoolean(valuesStr[i]));
+ break;
+ }
+ }
+
+ session.insertRecord(device, time, measurements, types, values);
+ }
+
+ @Override
+ public void run() {
+ try {
+ do {
+ ConsumerRecords<String, String> records = consumer.poll(Duration.ofSeconds(1));
+ Session session =
Review comment:
A new session is created in each loop. You can use the SessionPool.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls commented on pull request #4849: [IOTDB-2184]Update the code of Kafka example to use Session API and u…
Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #4849:
URL: https://github.com/apache/iotdb/pull/4849#issuecomment-1014209935
[](https://coveralls.io/builds/45670612)
Coverage decreased (-0.2%) to 67.871% when pulling **b56132976f5f58d3579fca73713b2f00897ed108 on Alibaba-HZY:update_kafka_example** into **707c2b46ca8825aea861371d05a6434df20ab98a on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] SteveYurongSu merged pull request #4849: [IOTDB-2184]Update the code of Kafka example to use Session API and u…
Posted by GitBox <gi...@apache.org>.
SteveYurongSu merged pull request #4849:
URL: https://github.com/apache/iotdb/pull/4849
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Alibaba-HZY commented on a change in pull request #4849: [IOTDB-2184]Update the code of Kafka example to use Session API and u…
Posted by GitBox <gi...@apache.org>.
Alibaba-HZY commented on a change in pull request #4849:
URL: https://github.com/apache/iotdb/pull/4849#discussion_r785610498
##########
File path: example/kafka/src/main/java/org/apache/iotdb/kafka/ConsumerThread.java
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.iotdb.kafka;
+
+import org.apache.iotdb.rpc.IoTDBConnectionException;
+import org.apache.iotdb.rpc.StatementExecutionException;
+import org.apache.iotdb.session.Session;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+
+import org.apache.kafka.clients.consumer.ConsumerRecord;
+import org.apache.kafka.clients.consumer.ConsumerRecords;
+import org.apache.kafka.clients.consumer.KafkaConsumer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/** The class is Thread class of Consumer. ConsumerThread. */
+public class ConsumerThread implements Runnable {
+
+ private static final Logger logger = LoggerFactory.getLogger(ConsumerThread.class);
+ private KafkaConsumer<String, String> consumer;
+
+ public ConsumerThread(KafkaConsumer<String, String> consumer) {
+ this.consumer = consumer;
+ }
+
+ /** insert data to IoTDB */
+ private void insert(Session session, String data)
+ throws IoTDBConnectionException, StatementExecutionException {
+ String[] dataArray = data.split(",");
+ String device = dataArray[0];
+ long time = Long.parseLong(dataArray[1]);
+ List<String> measurements = Arrays.asList(dataArray[2].split(":"));
+ List<TSDataType> types = new ArrayList<>();
+ for (String type : dataArray[3].split(":")) {
+ types.add(TSDataType.valueOf(type));
+ }
+
+ List<Object> values = new ArrayList<>();
+ String[] valuesStr = dataArray[4].split(":");
+ for (int i = 0; i < valuesStr.length; i++) {
+ switch (types.get(i)) {
+ case INT64:
+ values.add(Long.parseLong(valuesStr[i]));
+ break;
+ case DOUBLE:
+ values.add(Double.parseDouble(valuesStr[i]));
+ break;
+ case INT32:
+ values.add(Integer.parseInt(valuesStr[i]));
+ break;
+ case TEXT:
+ values.add(valuesStr[i]);
+ break;
+ case FLOAT:
+ values.add(Float.parseFloat(valuesStr[i]));
+ break;
+ case BOOLEAN:
+ values.add(Boolean.parseBoolean(valuesStr[i]));
+ break;
+ }
+ }
+
+ session.insertRecord(device, time, measurements, types, values);
+ }
+
+ @Override
+ public void run() {
+ try {
+ do {
+ ConsumerRecords<String, String> records = consumer.poll(Duration.ofSeconds(1));
+ Session session =
+ new Session(
+ Constant.IOTDB_CONNECTION_HOST,
+ Constant.IOTDB_CONNECTION_PORT,
+ Constant.IOTDB_CONNECTION_USER,
+ Constant.IOTDB_CONNECTION_PASSWORD);
+ session.open();
+ for (ConsumerRecord<String, String> record : records) {
+ insert(session, record.value());
+ }
+ } while (true);
+ } catch (Exception e) {
+ logger.error(e.getMessage());
Review comment:
yes i need to close it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Alibaba-HZY commented on a change in pull request #4849: [IOTDB-2184]Update the code of Kafka example to use Session API and u…
Posted by GitBox <gi...@apache.org>.
Alibaba-HZY commented on a change in pull request #4849:
URL: https://github.com/apache/iotdb/pull/4849#discussion_r785610852
##########
File path: example/kafka/src/main/java/org/apache/iotdb/kafka/Consumer.java
##########
@@ -0,0 +1,123 @@
+/*
+ * 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.iotdb.kafka;
+
+import org.apache.iotdb.rpc.IoTDBConnectionException;
+import org.apache.iotdb.rpc.StatementExecutionException;
+import org.apache.iotdb.session.Session;
+import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
+
+import org.apache.kafka.clients.consumer.ConsumerConfig;
+import org.apache.kafka.clients.consumer.KafkaConsumer;
+import org.apache.kafka.common.serialization.StringDeserializer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
Review comment:
i will repair it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org