public static class KafkaOffsetGen.CheckpointUtils extends Object
| Constructor and Description |
|---|
CheckpointUtils() |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.spark.streaming.kafka.OffsetRange[] |
computeOffsetRanges(HashMap<kafka.common.TopicAndPartition,org.apache.spark.streaming.kafka.KafkaCluster.LeaderOffset> fromOffsetMap,
HashMap<kafka.common.TopicAndPartition,org.apache.spark.streaming.kafka.KafkaCluster.LeaderOffset> toOffsetMap,
long numEvents)
Compute the offset ranges to read from Kafka, while handling newly added partitions, skews, event limits.
|
static String |
offsetsToStr(org.apache.spark.streaming.kafka.OffsetRange[] ranges)
String representation of checkpoint
|
static HashMap<kafka.common.TopicAndPartition,org.apache.spark.streaming.kafka.KafkaCluster.LeaderOffset> |
strToOffsets(String checkpointStr)
Reconstruct checkpoint from string.
|
static long |
totalNewMessages(org.apache.spark.streaming.kafka.OffsetRange[] ranges) |
public static HashMap<kafka.common.TopicAndPartition,org.apache.spark.streaming.kafka.KafkaCluster.LeaderOffset> strToOffsets(String checkpointStr)
public static String offsetsToStr(org.apache.spark.streaming.kafka.OffsetRange[] ranges)
Format: topic1,0:offset0,1:offset1,2:offset2, .....
public static org.apache.spark.streaming.kafka.OffsetRange[] computeOffsetRanges(HashMap<kafka.common.TopicAndPartition,org.apache.spark.streaming.kafka.KafkaCluster.LeaderOffset> fromOffsetMap, HashMap<kafka.common.TopicAndPartition,org.apache.spark.streaming.kafka.KafkaCluster.LeaderOffset> toOffsetMap, long numEvents)
fromOffsetMap - offsets where we left off last timetoOffsetMap - offsets of where each partitions is currently atnumEvents - maximum number of events to read.public static long totalNewMessages(org.apache.spark.streaming.kafka.OffsetRange[] ranges)
Copyright © 2019 The Apache Software Foundation. All rights reserved.