[ 
https://issues.apache.org/jira/browse/KAFKA-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14322308#comment-14322308
 ] 

Hongliang Su commented on KAFKA-1956:
-------------------------------------

I made those changes in KafkaConsumer.java

public synchronized ConsumerRecords<K, V> poll(long timeout) {

....

// block until the fetch response returns
        // TODO whether there is an effective way to wait until fetch response 
returns
        Cluster cluster = this.metadata.fetch();
        
        List<ClientResponse> lst  = null;
        while(lst == null || lst.isEmpty()) {
                
                reinstateFetches(cluster, now);
                lst = client.poll(timeout, now);
                
                if(lst.size() > 0) {
                        ClientResponse resp = lst.get(0);
                        short apiKey = 
resp.request().request().header().apiKey();
                        if(apiKey != ApiKeys.FETCH.id) {
                                log.debug("apiKey is {} not ApiKeys.FETCH:{} 
continue", apiKey, ApiKeys.FETCH.id);
                                lst.clear();
                        }
                                        
                }
        }
.....
}

> new consumer client can't fetch records from kafka server
> ---------------------------------------------------------
>
>                 Key: KAFKA-1956
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1956
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients, consumer
>    Affects Versions: 0.8.3
>            Reporter: Hongliang Su
>            Assignee: Neha Narkhede
>              Labels: patch
>   Original Estimate: 12h
>  Remaining Estimate: 12h
>
> new consumer client can't fetch records from kafka server
> suggestion:
> fetch response doesn't return even after one completeAll invoke
> block until the fetch response returns
> TODO: whether there is an effective way to wait until fetch response returns



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to