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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to