spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guoxiaolongzte <...@git.apache.org>
Subject [GitHub] spark issue #17580: [20269][Structured Streaming] add class 'JavaWordCountPr...
Date Thu, 13 Apr 2017 06:40:32 GMT
Github user guoxiaolongzte commented on the issue:

    https://github.com/apache/spark/pull/17580
  
    @jerryshao
    Excuse me,I would like to ask, these examples of Java examples, why use some of the Scala
to write it?thank you!
    
    
    
    
        SparkConf sparkConf = new SparkConf().setAppName("**JavaKafkaWordCount**");
        // Create the context with 2 seconds batch size
        JavaStreamingContext jssc = new JavaStreamingContext(sparkConf, new Duration(2000));
    
        int numThreads = Integer.parseInt(args[3]);
        Map<String, Integer> topicMap = new HashMap<>();
        String[] topics = args[2].split(",");
        for (String topic: topics) {
          topicMap.put(topic, numThreads);
        }
    
        JavaPairReceiverInputDStream<String, String> messages =
                KafkaUtils.createStream(jssc, args[0], args[1], topicMap);
    
        JavaDStream<String> lines = messages.map**(Tuple2::_2);**
    
    
    
    
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message