congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
KafkaZkClient.getConsumerOffset
Code IndexAdd Tabnine to your IDE (free)

How to use
getConsumerOffset
method
in
kafka.zk.KafkaZkClient

Best Java code snippets using kafka.zk.KafkaZkClient.getConsumerOffset (Showing top 4 results out of 315)

origin: apache/flume

private Map<TopicPartition, OffsetAndMetadata> getZookeeperOffsets(
    KafkaZkClient zkClient, KafkaConsumer<String, byte[]> consumer) {
 Map<TopicPartition, OffsetAndMetadata> offsets = new HashMap<>();
 List<PartitionInfo> partitions = consumer.partitionsFor(topicStr);
 for (PartitionInfo partition : partitions) {
  TopicPartition topicPartition = new TopicPartition(topicStr, partition.partition());
  Option<Object> optionOffset = zkClient.getConsumerOffset(groupId, topicPartition);
  if (optionOffset.nonEmpty()) {
   Long offset = (Long) optionOffset.get();
   OffsetAndMetadata offsetAndMetadata = new OffsetAndMetadata(offset);
   offsets.put(topicPartition, offsetAndMetadata);
  }
 }
 return offsets;
}
origin: apache/flume

 private Map<TopicPartition, OffsetAndMetadata> getZookeeperOffsets(
     KafkaZkClient zkClient, KafkaConsumer<String, byte[]> consumer, String topicStr) {

  Map<TopicPartition, OffsetAndMetadata> offsets = new HashMap<>();
  List<PartitionInfo> partitions = consumer.partitionsFor(topicStr);
  for (PartitionInfo partition : partitions) {
   TopicPartition topicPartition = new TopicPartition(topicStr, partition.partition());
   Option<Object> optionOffset = zkClient.getConsumerOffset(groupId, topicPartition);
   if (optionOffset.nonEmpty()) {
    Long offset = (Long) optionOffset.get();
    OffsetAndMetadata offsetAndMetadata = new OffsetAndMetadata(offset);
    offsets.put(topicPartition, offsetAndMetadata);
   }
  }
  return offsets;
 }
}
origin: org.apache.flume.flume-ng-channels/flume-kafka-channel

private Map<TopicPartition, OffsetAndMetadata> getZookeeperOffsets(
    KafkaZkClient zkClient, KafkaConsumer<String, byte[]> consumer) {
 Map<TopicPartition, OffsetAndMetadata> offsets = new HashMap<>();
 List<PartitionInfo> partitions = consumer.partitionsFor(topicStr);
 for (PartitionInfo partition : partitions) {
  TopicPartition topicPartition = new TopicPartition(topicStr, partition.partition());
  Option<Object> optionOffset = zkClient.getConsumerOffset(groupId, topicPartition);
  if (optionOffset.nonEmpty()) {
   Long offset = (Long) optionOffset.get();
   OffsetAndMetadata offsetAndMetadata = new OffsetAndMetadata(offset);
   offsets.put(topicPartition, offsetAndMetadata);
  }
 }
 return offsets;
}
origin: org.apache.flume.flume-ng-sources/flume-kafka-source

 private Map<TopicPartition, OffsetAndMetadata> getZookeeperOffsets(
     KafkaZkClient zkClient, KafkaConsumer<String, byte[]> consumer, String topicStr) {

  Map<TopicPartition, OffsetAndMetadata> offsets = new HashMap<>();
  List<PartitionInfo> partitions = consumer.partitionsFor(topicStr);
  for (PartitionInfo partition : partitions) {
   TopicPartition topicPartition = new TopicPartition(topicStr, partition.partition());
   Option<Object> optionOffset = zkClient.getConsumerOffset(groupId, topicPartition);
   if (optionOffset.nonEmpty()) {
    Long offset = (Long) optionOffset.get();
    OffsetAndMetadata offsetAndMetadata = new OffsetAndMetadata(offset);
    offsets.put(topicPartition, offsetAndMetadata);
   }
  }
  return offsets;
 }
}
kafka.zkKafkaZkClientgetConsumerOffset

Popular methods of KafkaZkClient

  • apply
  • <init>
  • topicExists
  • getAllBrokersInCluster
  • getLeaderForPartition
  • isTopicMarkedForDeletion
  • close
  • createPartitionReassignment
  • getBroker
  • getEntityConfigs
  • getPartitionAssignmentForTopics
  • reassignPartitionsInProgress
  • getPartitionAssignmentForTopics,
  • reassignPartitionsInProgress,
  • setOrCreateEntityConfigs

Popular in Java

  • Creating JSON documents from java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (Timer)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Join (org.hibernate.mapping)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now