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 Summary
Nested ClassesModifier and TypeClassDescriptionclassstatic enumclassclassNested classes/interfaces inherited from class com.linkedin.venice.service.AbstractVeniceService
AbstractVeniceService.ServiceState - 
Field Summary
Fields inherited from class com.linkedin.venice.service.AbstractVeniceService
logger, serviceState - 
Constructor Summary
ConstructorsConstructorDescriptionKafkaConsumerServiceDelegator(VeniceServerConfig serverConfig, com.linkedin.davinci.kafka.consumer.KafkaConsumerServiceDelegator.KafkaConsumerServiceBuilder consumerServiceConstructor, Function<String, Boolean> isAAWCStoreFunc)  - 
Method Summary
Modifier 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.AbstractKafkaConsumerService
unSubscribe 
- 
Constructor Details
- 
KafkaConsumerServiceDelegator
public KafkaConsumerServiceDelegator(VeniceServerConfig serverConfig, com.linkedin.davinci.kafka.consumer.KafkaConsumerServiceDelegator.KafkaConsumerServiceBuilder consumerServiceConstructor, Function<String, Boolean> isAAWCStoreFunc)  
 - 
 - 
Method Details
- 
getConsumerAssignedToVersionTopicPartition
public 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 classAbstractKafkaConsumerService
 - 
assignConsumerFor
public com.linkedin.davinci.kafka.consumer.SharedKafkaConsumer assignConsumerFor(PubSubTopic versionTopic, PubSubTopicPartition pubSubTopicPartition) - Specified by:
 assignConsumerForin classAbstractKafkaConsumerService
 - 
unsubscribeAll
- Specified by:
 unsubscribeAllin classAbstractKafkaConsumerService
 - 
unSubscribe
public void unSubscribe(PubSubTopic versionTopic, PubSubTopicPartition pubSubTopicPartition, long timeoutMs) - Specified by:
 unSubscribein classAbstractKafkaConsumerService
 - 
batchUnsubscribe
public void batchUnsubscribe(PubSubTopic versionTopic, Set<PubSubTopicPartition> topicPartitionsToUnSub) - Specified by:
 batchUnsubscribein classAbstractKafkaConsumerService
 - 
hasAnySubscriptionFor
- Specified by:
 hasAnySubscriptionForin classAbstractKafkaConsumerService
 - 
getMaxElapsedTimeMSSinceLastPollInConsumerPool
public long getMaxElapsedTimeMSSinceLastPollInConsumerPool()- Specified by:
 getMaxElapsedTimeMSSinceLastPollInConsumerPoolin classAbstractKafkaConsumerService
 - 
startConsumptionIntoDataReceiver
public void startConsumptionIntoDataReceiver(PartitionReplicaIngestionContext partitionReplicaIngestionContext, PubSubPosition lastReadPosition, ConsumedDataReceiver<List<DefaultPubSubMessage>> consumedDataReceiver) - Specified by:
 startConsumptionIntoDataReceiverin classAbstractKafkaConsumerService
 - 
getLatestOffsetBasedOnMetrics
public long getLatestOffsetBasedOnMetrics(PubSubTopic versionTopic, PubSubTopicPartition pubSubTopicPartition) - Specified by:
 getLatestOffsetBasedOnMetricsin classAbstractKafkaConsumerService
 - 
getIngestionInfoFor
public 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 classAbstractKafkaConsumerServicerespectRedundantLoggingFilter- 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 classAbstractKafkaConsumerService
 - 
startInner
- Specified by:
 startInnerin classAbstractVeniceService- 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 classAbstractVeniceService- Throws:
 Exception
 
 -