Package kafka.api

Examples of kafka.api.FetchRequest


    }
   
    public boolean fetchMore () throws IOException {
        if (!hasMore()) return false;
       
        FetchRequest fetchRequest =
            new FetchRequest(_request.getTopic(), _request.getPartition(), _offset, _bufferSize);
        List<FetchRequest> array = new ArrayList<FetchRequest>();
        array.add(fetchRequest);

        long tempTime = System.currentTimeMillis();
        _response = _consumer.multifetch(array);
View Full Code Here


                                                       KafkaProperties.kafkaServerPort,
                                                       KafkaProperties.connectionTimeOut,
                                                       KafkaProperties.kafkaProducerBufferSize);

    System.out.println("Testing single fetch");
    FetchRequest req = new FetchRequest(KafkaProperties.topic2, 0, 0L, 100);
    ByteBufferMessageSet messageSet = simpleConsumer.fetch(req);
    printMessages(messageSet);

    System.out.println("Testing single multi-fetch");
    req = new FetchRequest(KafkaProperties.topic2, 0, 0L, 100);
    List<FetchRequest> list = new ArrayList<FetchRequest>();
    list.add(req);
    req = new FetchRequest(KafkaProperties.topic3, 0, 0L, 100);
    list.add(req);
    MultiFetchResponse response = simpleConsumer.multifetch(list);
    int fetchReq = 0;
    for (ByteBufferMessageSet resMessageSet : response )
    {
View Full Code Here

    while(true)
    {
      List<FetchRequest> list = new ArrayList<FetchRequest>();
      for(int i=0 ; i < numParts; i++)
      {
        FetchRequest req = new FetchRequest(topic, i, offset, fetchSize);
        list.add(req);
      }


      MultiFetchResponse response = simpleConsumer.multifetch(list);
View Full Code Here

    consumer = new SimpleConsumer(broker.getHost(), broker.getPort(), config.socketTimeoutMs,config.socketReceiveBufferBytes, config.clientId);
  }
 
  public ByteBufferMessageSet fetchMessages(int partition, long offset) throws IOException {
    String topic = config.topic;
    FetchRequest req = new FetchRequestBuilder()
        .clientId(config.clientId)
        .addFetch(topic, partition, offset, config.fetchMaxBytes)
        .maxWait(config.fetchWaitMaxMs)
        .build();
    FetchResponse fetchResponse = null;
View Full Code Here

TOP

Related Classes of kafka.api.FetchRequest

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.