public class KafkaCluster
extends java.lang.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<java.lang.String,java.lang.String> kafkaParams) |
Modifier and Type | Method and Description |
---|---|
static <T> T |
checkErrors(scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,T> result)
If the result is right, return it, otherwise throw SparkException
|
KafkaCluster.SimpleConsumerConfig |
config() |
kafka.consumer.SimpleConsumer |
connect(java.lang.String host,
int port) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,kafka.consumer.SimpleConsumer> |
connectLeader(java.lang.String topic,
int partition) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.Tuple2<java.lang.String,java.lang.Object>> |
findLeader(java.lang.String topic,
int partition) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,scala.Tuple2<java.lang.String,java.lang.Object>>> |
findLeaders(scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetMetadataAndError>> |
getConsumerOffsetMetadata(java.lang.String groupId,
scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions)
Requires Kafka >= 0.8.1.1.
|
scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetMetadataAndError>> |
getConsumerOffsetMetadata(java.lang.String groupId,
scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions,
short consumerApiVersion) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object>> |
getConsumerOffsets(java.lang.String groupId,
scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions)
Requires Kafka >= 0.8.1.1.
|
scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object>> |
getConsumerOffsets(java.lang.String groupId,
scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions,
short consumerApiVersion) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.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<java.lang.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<java.lang.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<java.lang.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<java.lang.Throwable>,scala.collection.immutable.Set<kafka.api.TopicMetadata>> |
getPartitionMetadata(scala.collection.immutable.Set<java.lang.String> topics) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Set<kafka.common.TopicAndPartition>> |
getPartitions(scala.collection.immutable.Set<java.lang.String> topics) |
scala.collection.immutable.Map<java.lang.String,java.lang.String> |
kafkaParams() |
scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object>> |
setConsumerOffsetMetadata(java.lang.String groupId,
scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetAndMetadata> metadata)
Requires Kafka >= 0.8.1.1.
|
scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object>> |
setConsumerOffsetMetadata(java.lang.String groupId,
scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetAndMetadata> metadata,
short consumerApiVersion) |
scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object>> |
setConsumerOffsets(java.lang.String groupId,
scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object> offsets)
Requires Kafka >= 0.8.1.1.
|
scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object>> |
setConsumerOffsets(java.lang.String groupId,
scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object> offsets,
short consumerApiVersion) |
public KafkaCluster(scala.collection.immutable.Map<java.lang.String,java.lang.String> kafkaParams)
public static <T> T checkErrors(scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,T> result)
public scala.collection.immutable.Map<java.lang.String,java.lang.String> kafkaParams()
public KafkaCluster.SimpleConsumerConfig config()
public kafka.consumer.SimpleConsumer connect(java.lang.String host, int port)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,kafka.consumer.SimpleConsumer> connectLeader(java.lang.String topic, int partition)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.Tuple2<java.lang.String,java.lang.Object>> findLeader(java.lang.String topic, int partition)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,scala.Tuple2<java.lang.String,java.lang.Object>>> findLeaders(scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Set<kafka.common.TopicAndPartition>> getPartitions(scala.collection.immutable.Set<java.lang.String> topics)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Set<kafka.api.TopicMetadata>> getPartitionMetadata(scala.collection.immutable.Set<java.lang.String> topics)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.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<java.lang.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<java.lang.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<java.lang.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<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object>> getConsumerOffsets(java.lang.String groupId, scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object>> getConsumerOffsets(java.lang.String groupId, scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions, short consumerApiVersion)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetMetadataAndError>> getConsumerOffsetMetadata(java.lang.String groupId, scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetMetadataAndError>> getConsumerOffsetMetadata(java.lang.String groupId, scala.collection.immutable.Set<kafka.common.TopicAndPartition> topicAndPartitions, short consumerApiVersion)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object>> setConsumerOffsets(java.lang.String groupId, scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object> offsets)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object>> setConsumerOffsets(java.lang.String groupId, scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object> offsets, short consumerApiVersion)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object>> setConsumerOffsetMetadata(java.lang.String groupId, scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetAndMetadata> metadata)
public scala.util.Either<scala.collection.mutable.ArrayBuffer<java.lang.Throwable>,scala.collection.immutable.Map<kafka.common.TopicAndPartition,java.lang.Object>> setConsumerOffsetMetadata(java.lang.String groupId, scala.collection.immutable.Map<kafka.common.TopicAndPartition,kafka.common.OffsetAndMetadata> metadata, short consumerApiVersion)