It's a pair because there's a key and value for each message. If you just want a single topic, put a single topic in the map of topic -> number of partitions.
See https://github.com/apache/spark/blob/master/examples/src/main/java/org/apache/spark/examples/streaming/JavaKafkaWordCount.java On Wed, Feb 10, 2016 at 1:28 PM, Nipun Arora <nipunarora2...@gmail.com> wrote: > Hi, > > I am trying some basic integration and was going through the manual. > > I would like to read from a topic, and get a JavaReceiverInputDStream > <String> for messages in that topic. However the example is of > JavaPairReceiverInputDStream<>. How do I get a stream for only a single > topic in Java? > > Reference Page: > https://spark.apache.org/docs/1.3.0/streaming-kafka-integration.html > > import org.apache.spark.streaming.kafka.*; > > JavaPairReceiverInputDStream<String, String> kafkaStream = > KafkaUtils.createStream(streamingContext, > [ZK quorum], [consumer group id], [per-topic number of Kafka partitions > to consume]); > > > Also in the example above what does <String,String> signify? > > Thanks > Nipun >