kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [06/15] kylin git commit: minor, print sample kafka record in json format
Date Fri, 09 Dec 2016 04:25:48 GMT
minor, print sample kafka record in json format


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/763b1408
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/763b1408
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/763b1408

Branch: refs/heads/master-cdh5.7
Commit: 763b14086ad7334a995f494ded14654a154f81a7
Parents: 6599a06
Author: Billy Liu <billyliu@apache.org>
Authored: Thu Dec 8 18:40:04 2016 +0800
Committer: Billy Liu <billyliu@apache.org>
Committed: Thu Dec 8 18:40:20 2016 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/source/kafka/util/KafkaSampleProducer.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/763b1408/source-kafka/src/main/java/org/apache/kylin/source/kafka/util/KafkaSampleProducer.java
----------------------------------------------------------------------
diff --git a/source-kafka/src/main/java/org/apache/kylin/source/kafka/util/KafkaSampleProducer.java
b/source-kafka/src/main/java/org/apache/kylin/source/kafka/util/KafkaSampleProducer.java
index b8f98aa..4b91e03 100644
--- a/source-kafka/src/main/java/org/apache/kylin/source/kafka/util/KafkaSampleProducer.java
+++ b/source-kafka/src/main/java/org/apache/kylin/source/kafka/util/KafkaSampleProducer.java
@@ -34,6 +34,7 @@ import org.apache.commons.cli.Options;
 import org.apache.kafka.clients.producer.KafkaProducer;
 import org.apache.kafka.clients.producer.Producer;
 import org.apache.kafka.clients.producer.ProducerRecord;
+import org.apache.kylin.common.util.JsonUtil;
 import org.apache.kylin.common.util.OptionsHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -60,6 +61,7 @@ public class KafkaSampleProducer {
         String topic, broker;
         options.addOption(OPTION_TOPIC);
         options.addOption(OPTION_BROKER);
+        options.addOption(OPTION_INTERVAL);
         optionsHelper.parseOptions(options, args);
 
         logger.info("options: '" + optionsHelper.getOptionsAsString() + "'");
@@ -130,7 +132,7 @@ public class KafkaSampleProducer {
             record.put("user", user);
             //send message
             ProducerRecord<String, String> data = new ProducerRecord<>(topic,
System.currentTimeMillis() + "", mapper.writeValueAsString(record));
-            System.out.println("Sending 1 message: " + record.toString());
+            System.out.println("Sending 1 message: " + JsonUtil.writeValueAsString(record));
             producer.send(data);
             Thread.sleep(interval);
         }


Mime
View raw message