public class KafkaCluster
extends Object
implements scala.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
KafkaCluster.LeaderOffset |
static class |
KafkaCluster.LeaderOffset$ |
static class |
KafkaCluster.SimpleConsumerConfig
High-level kafka consumers connect to ZK.
|
static class |
KafkaCluster.SimpleConsumerConfig$ |
Constructor and Description |
---|
KafkaCluster(scala.collection.immutable.Map<String,String> kafkaParams) |
Modifier and Type | Method and Description |
---|---|
static <T> T |
checkErrors(scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,T> result)
If the result is right, return it, otherwise throw SparkException
|
KafkaCluster.SimpleConsumerConfig |
config() |
kafka.consumer.SimpleConsumer |
connect(String host,
int port) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,kafka.consumer.SimpleConsumer> |
connectLeader(String topic,
int partition) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.Tuple2<String,Object>> |
findLeader(String topic,
int partition) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,scala.Tuple2<String,Object>>> |
findLeaders(scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetMetadataAndError>> |
getConsumerOffsetMetadata(String groupId,
scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions)
Requires Kafka 0.8.1.1 or later.
|
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetMetadataAndError>> |
getConsumerOffsetMetadata(String groupId,
scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions,
short consumerApiVersion) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object>> |
getConsumerOffsets(String groupId,
scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions)
Requires Kafka 0.8.1.1 or later.
|
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object>> |
getConsumerOffsets(String groupId,
scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions,
short consumerApiVersion) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,KafkaCluster.LeaderOffset>> |
getEarliestLeaderOffsets(scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,KafkaCluster.LeaderOffset>> |
getLatestLeaderOffsets(scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,KafkaCluster.LeaderOffset>> |
getLeaderOffsets(scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions,
long before) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,scala.collection.Seq<KafkaCluster.LeaderOffset>>> |
getLeaderOffsets(scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions,
long before,
int maxNumOffsets) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Set<kafka.api.TopicMetadata>> |
getPartitionMetadata(scala.collection.immutable.Set<String> topics) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Set<kafka.common.TopicAndPartition>> |
getPartitions(scala.collection.immutable.Set<String> topics) |
scala.collection.immutable.Map<String,String> |
kafkaParams() |
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object>> |
setConsumerOffsetMetadata(String groupId,
scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetAndMetadata> metadata)
Requires Kafka 0.8.1.1 or later.
|
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object>> |
setConsumerOffsetMetadata(String groupId,
scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetAndMetadata> metadata,
short consumerApiVersion) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object>> |
setConsumerOffsets(String groupId,
scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object> offsets)
Requires Kafka 0.8.1.1 or later.
|
scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object>> |
setConsumerOffsets(String groupId,
scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object> offsets,
short consumerApiVersion) |
public KafkaCluster(scala.collection.immutable.Map<String,String> kafkaParams)
public static <T> T checkErrors(scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,T> result)
public scala.collection.immutable.Map<String,String> kafkaParams()
public KafkaCluster.SimpleConsumerConfig config()
public kafka.consumer.SimpleConsumer connect(String host, int port)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,kafka.consumer.SimpleConsumer> connectLeader(String topic, int partition)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.Tuple2<String,Object>> findLeader(String topic, int partition)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,scala.Tuple2<String,Object>>> findLeaders(scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Set<kafka.common.TopicAndPartition>> getPartitions(scala.collection.immutable.Set<String> topics)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Set<kafka.api.TopicMetadata>> getPartitionMetadata(scala.collection.immutable.Set<String> topics)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,KafkaCluster.LeaderOffset>> getLatestLeaderOffsets(scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,KafkaCluster.LeaderOffset>> getEarliestLeaderOffsets(scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,KafkaCluster.LeaderOffset>> getLeaderOffsets(scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions, long before)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,scala.collection.Seq<KafkaCluster.LeaderOffset>>> getLeaderOffsets(scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions, long before, int maxNumOffsets)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object>> getConsumerOffsets(String groupId, scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions)
groupId
- (undocumented)topicAndPartitions
- (undocumented)public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object>> getConsumerOffsets(String groupId, scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions, short consumerApiVersion)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetMetadataAndError>> getConsumerOffsetMetadata(String groupId, scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions)
groupId
- (undocumented)topicAndPartitions
- (undocumented)public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetMetadataAndError>> getConsumerOffsetMetadata(String groupId, scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions, short consumerApiVersion)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object>> setConsumerOffsets(String groupId, scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object> offsets)
groupId
- (undocumented)offsets
- (undocumented)public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object>> setConsumerOffsets(String groupId, scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object> offsets, short consumerApiVersion)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object>> setConsumerOffsetMetadata(String groupId, scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetAndMetadata> metadata)
groupId
- (undocumented)metadata
- (undocumented)public scala.util.Either<scala.collection.mutable.ArrayBuffer<Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,Object>> setConsumerOffsetMetadata(String groupId, scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetAndMetadata> metadata, short consumerApiVersion)