Package kafka.common

Examples of kafka.common.TopicAndPartition


                      .getConnectionString()),
                  partitionMetadata.leader().id());
              if (offsetRequestInfo.containsKey(leader)) {
                ArrayList<TopicAndPartition> topicAndPartitions = offsetRequestInfo
                    .get(leader);
                topicAndPartitions.add(new TopicAndPartition(
                    topicMetadata.topic(),
                    partitionMetadata.partitionId()));
                offsetRequestInfo.put(leader,
                    topicAndPartitions);
              } else {
                ArrayList<TopicAndPartition> topicAndPartitions = new ArrayList<TopicAndPartition>();
                topicAndPartitions.add(new TopicAndPartition(
                    topicMetadata.topic(),
                    partitionMetadata.partitionId()));
                offsetRequestInfo.put(leader,
                    topicAndPartitions);
              }
View Full Code Here


  public boolean fetch() throws IOException {
    if (currentOffset >= lastOffset) {
      return false;
    }
    long tempTime = System.currentTimeMillis();
    TopicAndPartition topicAndPartition = new TopicAndPartition(
        kafkaRequest.getTopic(), kafkaRequest.getPartition());
    log.debug("\nAsking for offset : " + (currentOffset));
    PartitionFetchInfo partitionFetchInfo = new PartitionFetchInfo(
        currentOffset, fetchBufferSize);
View Full Code Here

   * Fetch the earliest or latest available Kafka message offset.
   * @param offset offset to fetch.
   * @return Kafka message offset.
   */
  public long fetchOffset(Offset offset) {
    TopicAndPartition topicAndPartition = new TopicAndPartition(topic, partition);
    Map<TopicAndPartition, PartitionOffsetRequestInfo> requestInfo = Maps.newHashMap();
    requestInfo.put(topicAndPartition, new PartitionOffsetRequestInfo(offset.getValue(), 1));
    OffsetRequest request = new OffsetRequest(requestInfo, CurrentVersion(), clientName);

    if (consumer == null) {
View Full Code Here

    return getOffset(topic, partition, startOffsetTime);
  }
 
  public long getOffset( String topic,
            int partition, long startOffsetTime) {
        TopicAndPartition topicAndPartition = new TopicAndPartition(topic,
                partition);
        Map<TopicAndPartition, PartitionOffsetRequestInfo> requestInfo = new HashMap<TopicAndPartition, PartitionOffsetRequestInfo>();
        requestInfo.put(topicAndPartition, new PartitionOffsetRequestInfo(
                startOffsetTime, 1));
        OffsetRequest request = new OffsetRequest(requestInfo,
View Full Code Here

TOP

Related Classes of kafka.common.TopicAndPartition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.