Class ConsumerUtils
java.lang.Object
org.apache.kafka.clients.consumer.internals.ConsumerUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> List <ConsumerInterceptor<K, V>> static org.apache.kafka.common.IsolationLevelstatic ConsumerNetworkClientcreateConsumerNetworkClient(ConsumerConfig config, org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.LogContext logContext, org.apache.kafka.clients.ApiVersions apiVersions, org.apache.kafka.common.utils.Time time, org.apache.kafka.clients.Metadata metadata, org.apache.kafka.common.metrics.Sensor throttleTimeSensor, long retryBackoffMs, org.apache.kafka.common.telemetry.internals.ClientTelemetrySender clientTelemetrySender) static FetchMetricsManagercreateFetchMetricsManager(org.apache.kafka.common.metrics.Metrics metrics) static org.apache.kafka.common.utils.LogContextcreateLogContext(ConsumerConfig config, org.apache.kafka.clients.GroupRebalanceConfig groupRebalanceConfig) static org.apache.kafka.common.metrics.MetricscreateMetrics(ConsumerConfig config, org.apache.kafka.common.utils.Time time) static org.apache.kafka.common.metrics.MetricscreateMetrics(ConsumerConfig config, org.apache.kafka.common.utils.Time time, List<org.apache.kafka.common.metrics.MetricsReporter> reporters) static SubscriptionStatecreateSubscriptionState(ConsumerConfig config, org.apache.kafka.common.utils.LogContext logContext) static <T> Tstatic <T> Tstatic org.apache.kafka.common.KafkaExceptionstatic org.apache.kafka.common.KafkaExceptionmaybeWrapAsKafkaException(Throwable t, String message) static voidrefreshCommittedOffsets(Map<org.apache.kafka.common.TopicPartition, OffsetAndMetadata> offsetsAndMetadata, ConsumerMetadata metadata, SubscriptionState subscriptions) Update subscription state and metadata using the provided committed offsets: Update partition offsets with the committed offsets Update the metadata with any newer leader epoch discovered in the committed offsets metadata
-
Field Details
-
DEFAULT_CLOSE_TIMEOUT_MS
public static final long DEFAULT_CLOSE_TIMEOUT_MS- See Also:
-
CONSUMER_JMX_PREFIX
- See Also:
-
CONSUMER_METRIC_GROUP_PREFIX
- See Also:
-
CONSUMER_MAX_INFLIGHT_REQUESTS_PER_CONNECTION
public static final int CONSUMER_MAX_INFLIGHT_REQUESTS_PER_CONNECTIONA fixed, large enough value will suffice for max.- See Also:
-
-
Constructor Details
-
ConsumerUtils
public ConsumerUtils()
-
-
Method Details
-
createConsumerNetworkClient
public static ConsumerNetworkClient createConsumerNetworkClient(ConsumerConfig config, org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.utils.LogContext logContext, org.apache.kafka.clients.ApiVersions apiVersions, org.apache.kafka.common.utils.Time time, org.apache.kafka.clients.Metadata metadata, org.apache.kafka.common.metrics.Sensor throttleTimeSensor, long retryBackoffMs, org.apache.kafka.common.telemetry.internals.ClientTelemetrySender clientTelemetrySender) -
createLogContext
public static org.apache.kafka.common.utils.LogContext createLogContext(ConsumerConfig config, org.apache.kafka.clients.GroupRebalanceConfig groupRebalanceConfig) -
configuredIsolationLevel
public static org.apache.kafka.common.IsolationLevel configuredIsolationLevel(ConsumerConfig config) -
createSubscriptionState
public static SubscriptionState createSubscriptionState(ConsumerConfig config, org.apache.kafka.common.utils.LogContext logContext) -
createMetrics
public static org.apache.kafka.common.metrics.Metrics createMetrics(ConsumerConfig config, org.apache.kafka.common.utils.Time time) -
createMetrics
public static org.apache.kafka.common.metrics.Metrics createMetrics(ConsumerConfig config, org.apache.kafka.common.utils.Time time, List<org.apache.kafka.common.metrics.MetricsReporter> reporters) -
createFetchMetricsManager
public static FetchMetricsManager createFetchMetricsManager(org.apache.kafka.common.metrics.Metrics metrics) -
configuredConsumerInterceptors
public static <K,V> List<ConsumerInterceptor<K,V>> configuredConsumerInterceptors(ConsumerConfig config) -
refreshCommittedOffsets
public static void refreshCommittedOffsets(Map<org.apache.kafka.common.TopicPartition, OffsetAndMetadata> offsetsAndMetadata, ConsumerMetadata metadata, SubscriptionState subscriptions) Update subscription state and metadata using the provided committed offsets:- Update partition offsets with the committed offsets
- Update the metadata with any newer leader epoch discovered in the committed offsets metadata
This will ignore any partition included in theoffsetsAndMetadataparameter that may no longer be assigned.- Parameters:
offsetsAndMetadata- Committed offsets and metadata to be used for updating the subscription state and metadata object.metadata- Metadata object to update with a new leader epoch if discovered in the committed offsets' metadata.subscriptions- Subscription state to update, setting partitions' offsets to the committed offsets.
-
getResult
-
getResult
-
maybeWrapAsKafkaException
-
maybeWrapAsKafkaException
-