public class TierTopicConsumer extends Object implements Runnable
register(kafka.tier.TopicIdPartition, kafka.tier.topic.TierTopicConsumer.ClientCtx)
and deregister(kafka.tier.TopicIdPartition)
materialization of tier partition
states.Modifier and Type | Class and Description |
---|---|
static interface |
TierTopicConsumer.ClientCtx |
Constructor and Description |
---|
TierTopicConsumer(TierTopicManagerConfig config,
kafka.server.LogDirFailureChannel logDirFailureChannel,
TierStateFetcher tierStateFetcher,
org.apache.kafka.common.metrics.Metrics metrics,
org.apache.kafka.common.utils.Time time) |
TierTopicConsumer(TierTopicManagerConfig config,
Supplier<org.apache.kafka.clients.consumer.Consumer<byte[],byte[]>> primaryConsumerSupplier,
Supplier<org.apache.kafka.clients.consumer.Consumer<byte[],byte[]>> catchupConsumerSupplier,
TierTopicManagerCommitter committer,
TierStateFetcher tierStateFetcher,
Optional<org.apache.kafka.common.metrics.Metrics> metrics,
org.apache.kafka.common.utils.Time time) |
Modifier and Type | Method and Description |
---|---|
void |
cancelTracked(AbstractTierMetadata metadata)
Cancel materialization tracking for provided metadata.
|
void |
cleanup() |
void |
deregister(TopicIdPartition partition)
Deregister this topic partition and stop materialization.
|
void |
doWork() |
void |
initialize(InitializedTierTopic tierTopic)
Start consuming the tier topic.
|
protected boolean |
isPartitionRegistered(TopicIdPartition partition)
Check if topic partition is registered.
|
boolean |
isReady() |
void |
register(Map<TopicIdPartition,TierTopicConsumer.ClientCtx> partitionsToRegister)
Register topic partitions to be materialized.
|
void |
register(TopicIdPartition partition,
TierTopicConsumer.ClientCtx clientCtx)
Register topic partition to be materialized.
|
void |
run() |
void |
shutdown() |
Map<Integer,OffsetAndEpoch> |
snapshotPositions()
Takes and returns a snapshot of the current positions for all tier topic partitions.
|
void |
start() |
void |
trackMaterialization(AbstractTierMetadata metadata,
CompletableFuture<TierPartitionState.AppendResult> future)
Track materialization of provided metadata.
|
void |
writePositions(Map<Integer,OffsetAndEpoch> positions) |
public TierTopicConsumer(TierTopicManagerConfig config, kafka.server.LogDirFailureChannel logDirFailureChannel, TierStateFetcher tierStateFetcher, org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.Time time)
public TierTopicConsumer(TierTopicManagerConfig config, Supplier<org.apache.kafka.clients.consumer.Consumer<byte[],byte[]>> primaryConsumerSupplier, Supplier<org.apache.kafka.clients.consumer.Consumer<byte[],byte[]>> catchupConsumerSupplier, TierTopicManagerCommitter committer, TierStateFetcher tierStateFetcher, Optional<org.apache.kafka.common.metrics.Metrics> metrics, org.apache.kafka.common.utils.Time time)
protected boolean isPartitionRegistered(TopicIdPartition partition)
partition
- Topic partition to registerpublic void register(TopicIdPartition partition, TierTopicConsumer.ClientCtx clientCtx)
partition
- Topic partition to registerclientCtx
- Client context for this registrationpublic void register(Map<TopicIdPartition,TierTopicConsumer.ClientCtx> partitionsToRegister)
register(TopicIdPartition, ClientCtx)
but allows registration for multiple topic partitions atomically, to ensure all topic partitions can begin
materialization at the same time.partitionsToRegister
- Topic partitions to registerpublic void deregister(TopicIdPartition partition)
partition
- Topic partition to deregisterpublic void trackMaterialization(AbstractTierMetadata metadata, CompletableFuture<TierPartitionState.AppendResult> future)
metadata
- Metadata to track materialization forfuture
- Corresponding future; the future is completed after successful materialization of the metadata. It
may be completed exceptionally if the partition is no longer being materialized or if we ran into
unexpected state.public void cancelTracked(AbstractTierMetadata metadata)
metadata
- Metadata to cancel materialization tracking forpublic void initialize(InitializedTierTopic tierTopic)
tierTopic
- An instance of InitializedTierTopic
.public void start()
public Map<Integer,OffsetAndEpoch> snapshotPositions()
public void writePositions(Map<Integer,OffsetAndEpoch> positions)
public boolean isReady()
public void shutdown()
public void cleanup()
public void doWork()