Class ClientUtils
- java.lang.Object
-
- org.apache.kafka.streams.processor.internals.ClientUtils
-
public class ClientUtils extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ClientUtils.QuietAdminClientConfig
-
Constructor Summary
Constructors Constructor Description ClientUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<org.apache.kafka.common.MetricName,org.apache.kafka.common.Metric>
adminClientMetrics(org.apache.kafka.clients.admin.Admin adminClient)
static java.util.Map<org.apache.kafka.common.MetricName,org.apache.kafka.common.Metric>
consumerMetrics(org.apache.kafka.clients.consumer.Consumer<byte[],byte[]> mainConsumer, org.apache.kafka.clients.consumer.Consumer<byte[],byte[]> restoreConsumer)
static java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long>
fetchCommittedOffsets(java.util.Set<org.apache.kafka.common.TopicPartition> partitions, org.apache.kafka.clients.consumer.Consumer<byte[],byte[]> consumer)
static java.util.Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.admin.ListOffsetsResult.ListOffsetsResultInfo>
fetchEndOffsets(java.util.Collection<org.apache.kafka.common.TopicPartition> partitions, org.apache.kafka.clients.admin.Admin adminClient)
static org.apache.kafka.common.KafkaFuture<java.util.Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.admin.ListOffsetsResult.ListOffsetsResultInfo>>
fetchEndOffsetsFuture(java.util.Collection<org.apache.kafka.common.TopicPartition> partitions, org.apache.kafka.clients.admin.Admin adminClient)
static java.lang.String
getConsumerClientId(java.lang.String threadClientId)
static java.util.Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.admin.ListOffsetsResult.ListOffsetsResultInfo>
getEndOffsets(org.apache.kafka.common.KafkaFuture<java.util.Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.admin.ListOffsetsResult.ListOffsetsResultInfo>> endOffsetsFuture)
A helper method that wraps theFuture#get
call and rethrows any thrown exception as a StreamsExceptionstatic java.lang.String
getRestoreConsumerClientId(java.lang.String threadClientId)
static java.lang.String
getSharedAdminClientId(java.lang.String clientId)
static java.lang.String
getTaskProducerClientId(java.lang.String threadClientId, TaskId taskId)
static java.lang.String
getThreadProducerClientId(java.lang.String threadClientId)
static java.util.Map<org.apache.kafka.common.MetricName,org.apache.kafka.common.Metric>
producerMetrics(java.util.Collection<StreamsProducer> producers)
-
-
-
Method Detail
-
getSharedAdminClientId
public static java.lang.String getSharedAdminClientId(java.lang.String clientId)
-
getConsumerClientId
public static java.lang.String getConsumerClientId(java.lang.String threadClientId)
-
getRestoreConsumerClientId
public static java.lang.String getRestoreConsumerClientId(java.lang.String threadClientId)
-
getThreadProducerClientId
public static java.lang.String getThreadProducerClientId(java.lang.String threadClientId)
-
getTaskProducerClientId
public static java.lang.String getTaskProducerClientId(java.lang.String threadClientId, TaskId taskId)
-
consumerMetrics
public static java.util.Map<org.apache.kafka.common.MetricName,org.apache.kafka.common.Metric> consumerMetrics(org.apache.kafka.clients.consumer.Consumer<byte[],byte[]> mainConsumer, org.apache.kafka.clients.consumer.Consumer<byte[],byte[]> restoreConsumer)
-
adminClientMetrics
public static java.util.Map<org.apache.kafka.common.MetricName,org.apache.kafka.common.Metric> adminClientMetrics(org.apache.kafka.clients.admin.Admin adminClient)
-
producerMetrics
public static java.util.Map<org.apache.kafka.common.MetricName,org.apache.kafka.common.Metric> producerMetrics(java.util.Collection<StreamsProducer> producers)
-
fetchCommittedOffsets
public static java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long> fetchCommittedOffsets(java.util.Set<org.apache.kafka.common.TopicPartition> partitions, org.apache.kafka.clients.consumer.Consumer<byte[],byte[]> consumer)
- Throws:
StreamsException
- if the consumer throws an exceptionorg.apache.kafka.common.errors.TimeoutException
- if the request times out
-
fetchEndOffsetsFuture
public static org.apache.kafka.common.KafkaFuture<java.util.Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.admin.ListOffsetsResult.ListOffsetsResultInfo>> fetchEndOffsetsFuture(java.util.Collection<org.apache.kafka.common.TopicPartition> partitions, org.apache.kafka.clients.admin.Admin adminClient)
-
getEndOffsets
public static java.util.Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.admin.ListOffsetsResult.ListOffsetsResultInfo> getEndOffsets(org.apache.kafka.common.KafkaFuture<java.util.Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.admin.ListOffsetsResult.ListOffsetsResultInfo>> endOffsetsFuture)
A helper method that wraps theFuture#get
call and rethrows any thrown exception as a StreamsException- Throws:
StreamsException
- if the admin client request throws an exception
-
fetchEndOffsets
public static java.util.Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.admin.ListOffsetsResult.ListOffsetsResultInfo> fetchEndOffsets(java.util.Collection<org.apache.kafka.common.TopicPartition> partitions, org.apache.kafka.clients.admin.Admin adminClient)
- Throws:
StreamsException
- if the admin client request throws an exception
-
-