Class KafkaConsumerServiceDelegator
java.lang.Object
com.linkedin.venice.service.AbstractVeniceService
com.linkedin.davinci.kafka.consumer.AbstractKafkaConsumerService
com.linkedin.davinci.kafka.consumer.KafkaConsumerServiceDelegator
- All Implemented Interfaces:
- Closeable,- AutoCloseable
This delegator impl is used to distribute different partition requests into different consumer service.
 When {#link ConfigKeys#SERVER_DEDICATED_CONSUMER_POOL_FOR_AA_WC_LEADER_ENABLED} is off, this class
 will always return the default consumer service.
 When the option is on, it will return the dedicated consumer service when the topic partition belongs
 to a Real-time topic and the corresponding store has active/active or write compute enabled.
 The reason to use dedicated consumer pool for leader replicas of active/active or write compute stores is
 that handling the writes before putting into the drainer queue is too expensive comparing to others.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionclassstatic enumclassclassNested classes/interfaces inherited from class com.linkedin.venice.service.AbstractVeniceServiceAbstractVeniceService.ServiceState
- 
Field SummaryFields inherited from class com.linkedin.venice.service.AbstractVeniceServicelogger, serviceState
- 
Constructor SummaryConstructorsConstructorDescriptionKafkaConsumerServiceDelegator(VeniceServerConfig serverConfig, com.linkedin.davinci.kafka.consumer.KafkaConsumerServiceDelegator.KafkaConsumerServiceBuilder consumerServiceConstructor, Function<String, Boolean> isAAWCStoreFunc) 
- 
Method SummaryModifier and TypeMethodDescriptioncom.linkedin.davinci.kafka.consumer.SharedKafkaConsumerassignConsumerFor(PubSubTopic versionTopic, PubSubTopicPartition pubSubTopicPartition) voidbatchUnsubscribe(PubSubTopic versionTopic, Set<PubSubTopicPartition> topicPartitionsToUnSub) com.linkedin.davinci.kafka.consumer.SharedKafkaConsumergetConsumerAssignedToVersionTopicPartition(PubSubTopic versionTopic, PubSubTopicPartition topicPartition) There might be no consumer service found for the version topic and topic partition, which means the topic partition is not subscribed.getIngestionInfoFor(PubSubTopic versionTopic, PubSubTopicPartition pubSubTopicPartition, boolean respectRedundantLoggingFilter) This is for providing ingestion related information for a specific topic partition from the implementation of this class.longgetLatestOffsetBasedOnMetrics(PubSubTopic versionTopic, PubSubTopicPartition pubSubTopicPartition) longgetStaleTopicPartitions(long thresholdTimestamp) booleanhasAnySubscriptionFor(PubSubTopic versionTopic) voidstartConsumptionIntoDataReceiver(PartitionReplicaIngestionContext partitionReplicaIngestionContext, PubSubPosition lastReadPosition, ConsumedDataReceiver<List<DefaultPubSubMessage>> consumedDataReceiver) booleanvoidvoidunSubscribe(PubSubTopic versionTopic, PubSubTopicPartition pubSubTopicPartition, long timeoutMs) voidunsubscribeAll(PubSubTopic versionTopic) Methods inherited from class com.linkedin.davinci.kafka.consumer.AbstractKafkaConsumerServiceunSubscribe
- 
Constructor Details- 
KafkaConsumerServiceDelegatorpublic KafkaConsumerServiceDelegator(VeniceServerConfig serverConfig, com.linkedin.davinci.kafka.consumer.KafkaConsumerServiceDelegator.KafkaConsumerServiceBuilder consumerServiceConstructor, Function<String, Boolean> isAAWCStoreFunc) 
 
- 
- 
Method Details- 
getConsumerAssignedToVersionTopicPartitionpublic com.linkedin.davinci.kafka.consumer.SharedKafkaConsumer getConsumerAssignedToVersionTopicPartition(PubSubTopic versionTopic, PubSubTopicPartition topicPartition) There might be no consumer service found for the version topic and topic partition, which means the topic partition is not subscribed. In this case, we should return null. Caller should check the return value and handle it properly.- Specified by:
- getConsumerAssignedToVersionTopicPartitionin class- AbstractKafkaConsumerService
 
- 
assignConsumerForpublic com.linkedin.davinci.kafka.consumer.SharedKafkaConsumer assignConsumerFor(PubSubTopic versionTopic, PubSubTopicPartition pubSubTopicPartition) - Specified by:
- assignConsumerForin class- AbstractKafkaConsumerService
 
- 
unsubscribeAll- Specified by:
- unsubscribeAllin class- AbstractKafkaConsumerService
 
- 
unSubscribepublic void unSubscribe(PubSubTopic versionTopic, PubSubTopicPartition pubSubTopicPartition, long timeoutMs) - Specified by:
- unSubscribein class- AbstractKafkaConsumerService
 
- 
batchUnsubscribepublic void batchUnsubscribe(PubSubTopic versionTopic, Set<PubSubTopicPartition> topicPartitionsToUnSub) - Specified by:
- batchUnsubscribein class- AbstractKafkaConsumerService
 
- 
hasAnySubscriptionFor- Specified by:
- hasAnySubscriptionForin class- AbstractKafkaConsumerService
 
- 
getMaxElapsedTimeMSSinceLastPollInConsumerPoolpublic long getMaxElapsedTimeMSSinceLastPollInConsumerPool()- Specified by:
- getMaxElapsedTimeMSSinceLastPollInConsumerPoolin class- AbstractKafkaConsumerService
 
- 
startConsumptionIntoDataReceiverpublic void startConsumptionIntoDataReceiver(PartitionReplicaIngestionContext partitionReplicaIngestionContext, PubSubPosition lastReadPosition, ConsumedDataReceiver<List<DefaultPubSubMessage>> consumedDataReceiver) - Specified by:
- startConsumptionIntoDataReceiverin class- AbstractKafkaConsumerService
 
- 
getLatestOffsetBasedOnMetricspublic long getLatestOffsetBasedOnMetrics(PubSubTopic versionTopic, PubSubTopicPartition pubSubTopicPartition) - Specified by:
- getLatestOffsetBasedOnMetricsin class- AbstractKafkaConsumerService
 
- 
getIngestionInfoForpublic Map<PubSubTopicPartition,TopicPartitionIngestionInfo> getIngestionInfoFor(PubSubTopic versionTopic, PubSubTopicPartition pubSubTopicPartition, boolean respectRedundantLoggingFilter) Description copied from class:AbstractKafkaConsumerServiceThis is for providing ingestion related information for a specific topic partition from the implementation of this class.- Specified by:
- getIngestionInfoForin class- AbstractKafkaConsumerService
- respectRedundantLoggingFilter- here is to guide if we need to prepare the info map, set to true when calling from heartbeat monitoring to enable rate-limiting; set to false for admin commands or tests where all info is needed.
 
- 
getStaleTopicPartitions- Specified by:
- getStaleTopicPartitionsin class- AbstractKafkaConsumerService
 
- 
startInner- Specified by:
- startInnerin class- AbstractVeniceService
- Returns:
- true if the service is completely started,
         false if it is still starting asynchronously (in this case, it is the implementer's
         responsibility to set AbstractVeniceService.serviceStatetoAbstractVeniceService.ServiceState.STARTEDupon completion of the async work).
- Throws:
- Exception
 
- 
stopInner- Specified by:
- stopInnerin class- AbstractVeniceService
- Throws:
- Exception
 
 
-