public class KafkaUtils
extends Object
Constructor and Description |
---|
KafkaUtils() |
Modifier and Type | Method and Description |
---|---|
static <K,V,U extends kafka.serializer.Decoder<?>,T extends kafka.serializer.Decoder<?>> |
createStream(JavaStreamingContext jssc,
Class<K> keyTypeClass,
Class<V> valueTypeClass,
Class<U> keyDecoderClass,
Class<T> valueDecoderClass,
java.util.Map<String,String> kafkaParams,
java.util.Map<String,Integer> topics,
StorageLevel storageLevel)
Create an input stream that pulls messages from a Kafka Broker.
|
static JavaPairReceiverInputDStream<String,String> |
createStream(JavaStreamingContext jssc,
String zkQuorum,
String groupId,
java.util.Map<String,Integer> topics)
Create an input stream that pulls messages from a Kafka Broker.
|
static JavaPairReceiverInputDStream<String,String> |
createStream(JavaStreamingContext jssc,
String zkQuorum,
String groupId,
java.util.Map<String,Integer> topics,
StorageLevel storageLevel)
Create an input stream that pulls messages from a Kafka Broker.
|
static <K,V,U extends kafka.serializer.Decoder<?>,T extends kafka.serializer.Decoder<?>> |
createStream(StreamingContext ssc,
scala.collection.immutable.Map<String,String> kafkaParams,
scala.collection.immutable.Map<String,Object> topics,
StorageLevel storageLevel,
scala.reflect.ClassTag<K> evidence$1,
scala.reflect.ClassTag<V> evidence$2,
scala.reflect.ClassTag<U> evidence$3,
scala.reflect.ClassTag<T> evidence$4)
Create an input stream that pulls messages from a Kafka Broker.
|
static ReceiverInputDStream<scala.Tuple2<String,String>> |
createStream(StreamingContext ssc,
String zkQuorum,
String groupId,
scala.collection.immutable.Map<String,Object> topics,
StorageLevel storageLevel)
Create an input stream that pulls messages from a Kafka Broker.
|
public static ReceiverInputDStream<scala.Tuple2<String,String>> createStream(StreamingContext ssc, String zkQuorum, String groupId, scala.collection.immutable.Map<String,Object> topics, StorageLevel storageLevel)
ssc
- StreamingContext objectzkQuorum
- Zookeeper quorum (hostname:port,hostname:port,..)groupId
- The group id for this consumertopics
- Map of (topic_name -> numPartitions) to consume. Each partition is consumed
in its own threadstorageLevel
- Storage level to use for storing the received objects
(default: StorageLevel.MEMORY_AND_DISK_SER_2)public static <K,V,U extends kafka.serializer.Decoder<?>,T extends kafka.serializer.Decoder<?>> ReceiverInputDStream<scala.Tuple2<K,V>> createStream(StreamingContext ssc, scala.collection.immutable.Map<String,String> kafkaParams, scala.collection.immutable.Map<String,Object> topics, StorageLevel storageLevel, scala.reflect.ClassTag<K> evidence$1, scala.reflect.ClassTag<V> evidence$2, scala.reflect.ClassTag<U> evidence$3, scala.reflect.ClassTag<T> evidence$4)
ssc
- StreamingContext objectkafkaParams
- Map of kafka configuration parameters,
see http://kafka.apache.org/08/configuration.htmltopics
- Map of (topic_name -> numPartitions) to consume. Each partition is consumed
in its own thread.storageLevel
- Storage level to use for storing the received objectspublic static JavaPairReceiverInputDStream<String,String> createStream(JavaStreamingContext jssc, String zkQuorum, String groupId, java.util.Map<String,Integer> topics)
jssc
- JavaStreamingContext objectzkQuorum
- Zookeeper quorum (hostname:port,hostname:port,..)groupId
- The group id for this consumertopics
- Map of (topic_name -> numPartitions) to consume. Each partition is consumed
in its own threadpublic static JavaPairReceiverInputDStream<String,String> createStream(JavaStreamingContext jssc, String zkQuorum, String groupId, java.util.Map<String,Integer> topics, StorageLevel storageLevel)
jssc
- JavaStreamingContext objectzkQuorum
- Zookeeper quorum (hostname:port,hostname:port,..).groupId
- The group id for this consumer.topics
- Map of (topic_name -> numPartitions) to consume. Each partition is consumed
in its own thread.storageLevel
- RDD storage level.public static <K,V,U extends kafka.serializer.Decoder<?>,T extends kafka.serializer.Decoder<?>> JavaPairReceiverInputDStream<K,V> createStream(JavaStreamingContext jssc, Class<K> keyTypeClass, Class<V> valueTypeClass, Class<U> keyDecoderClass, Class<T> valueDecoderClass, java.util.Map<String,String> kafkaParams, java.util.Map<String,Integer> topics, StorageLevel storageLevel)
jssc
- JavaStreamingContext objectkeyTypeClass
- Key type of RDDvalueTypeClass
- value type of RDDkeyDecoderClass
- Type of kafka key decodervalueDecoderClass
- Type of kafka value decoderkafkaParams
- Map of kafka configuration parameters,
see http://kafka.apache.org/08/configuration.htmltopics
- Map of (topic_name -> numPartitions) to consume. Each partition is consumed
in its own threadstorageLevel
- RDD storage level.