public class TierTopicConsumer
extends java.lang.Object
implements java.lang.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) |
TierTopicConsumer(TierTopicManagerConfig config,
java.util.function.Supplier<org.apache.kafka.clients.consumer.Consumer<byte[],byte[]>> primaryConsumerSupplier,
java.util.function.Supplier<org.apache.kafka.clients.consumer.Consumer<byte[],byte[]>> catchupConsumerSupplier,
TierTopicManagerCommitter committer) |
Modifier and Type | Method and Description |
---|---|
void |
cancelTracked(AbstractTierMetadata metadata)
Cancel materialization tracking for provided metadata.
|
void |
cleanup() |
void |
commitPositions(java.util.Iterator<TierPartitionState> tierPartitionStateIterator)
Commit positions for the provided tier partition states.
|
void |
deregister(TopicIdPartition partition)
Deregister this topic partition and stop materialization.
|
void |
doWork() |
void |
initialize(InitializedTierTopic tierTopic)
Start consuming the tier topic.
|
boolean |
isReady() |
void |
register(java.util.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() |
void |
start() |
void |
trackMaterialization(AbstractTierMetadata metadata,
java.util.concurrent.CompletableFuture<TierPartitionState.AppendResult> future)
Track materialization of provided metadata.
|
public TierTopicConsumer(TierTopicManagerConfig config, kafka.server.LogDirFailureChannel logDirFailureChannel)
public TierTopicConsumer(TierTopicManagerConfig config, java.util.function.Supplier<org.apache.kafka.clients.consumer.Consumer<byte[],byte[]>> primaryConsumerSupplier, java.util.function.Supplier<org.apache.kafka.clients.consumer.Consumer<byte[],byte[]>> catchupConsumerSupplier, TierTopicManagerCommitter committer)
public void register(TopicIdPartition partition, TierTopicConsumer.ClientCtx clientCtx)
partition
- Topic partition to registerclientCtx
- Client context for this registrationpublic void register(java.util.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, java.util.concurrent.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 void commitPositions(java.util.Iterator<TierPartitionState> tierPartitionStateIterator)
tierPartitionStateIterator
- Iterator over all tier partition states.public boolean isReady()
public void shutdown()
public void cleanup()
public void run()
run
in interface java.lang.Runnable
public void doWork()