Creating Two DStream from Kafka topic in Spark Streaming not working -


in spark streaming application . creating 2 dstream 2 kafka topic. doing , because need process 2 dstream differently. below code example:

object kafkaconsumertest3 {   var sc:sparkcontext = null   def main(args: array[string]) {        logger.getlogger("org").setlevel(level.off);     logger.getlogger("akka").setlevel(level.off);      val array(zkquorum, group, topics1, topics2, numthreads) = array("localhost:2181", "group3", "test_topic4", "test_topic5","5")     val sparkconf = new sparkconf().setappname("sparkconsumer").setmaster("local[2]")     sc = new sparkcontext(sparkconf)     val ssc = new streamingcontext(sc, seconds(2))       val topicmap1 = topics1.split(",").map((_, numthreads.toint)).tomap     val topicmap2 = topics2.split(",").map((_, numthreads.toint)).tomap      val lines2 = kafkautils.createstream(ssc, zkquorum, group, topicmap2).map(_._2)     val lines1 = kafkautils.createstream(ssc, zkquorum, group, topicmap1).map(_._2)      lines2.foreachrdd{rdd =>       rdd.foreach { println }}      lines1.foreachrdd{rdd =>       rdd.foreach { println }}      ssc.start()     ssc.awaittermination()   } } 

both topics may or may not have data . in case first topic not getting data second topic getting. spark application not printing data. , there no exception well. there missing? or how resolve issue.

found out issue above code. problem have used master local[2] , registering 2 receiver.increasing number of thread solve problem.


Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -