You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Michael Andre Pearce (JIRA)" <ji...@apache.org> on 2017/06/29 07:54:00 UTC

[jira] [Created] (KAFKA-5537) Subscribe Earliest is not working as in 0.10.2.1

Michael Andre Pearce created KAFKA-5537:
-------------------------------------------

             Summary: Subscribe Earliest is not working as in 0.10.2.1
                 Key: KAFKA-5537
                 URL: https://issues.apache.org/jira/browse/KAFKA-5537
             Project: Kafka
          Issue Type: Bug
    Affects Versions: 0.11.0.0
            Reporter: Michael Andre Pearce
            Priority: Critical


We have seen issue with subscription where auto offset when set to earliest does not behave the same as in 0.10.2.1 release.

We have managed to create a repeatable test for this, which passes when pointing to 0.10.2.1 broker.


    @Test
    public void testSubscribeEarliest(){

        Properties properties = new Properties();
        properties.setProperty(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, bootstrap);
        properties.setProperty(ConsumerConfig.GROUP_ID_CONFIG, "test-group");
        properties.setProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
        KafkaProducer<byte[], byte[]> kafkaProducer = new KafkaProducer<>(properties, new ByteArraySerializer(), new ByteArraySerializer());
        kafkaProducer.send(new ProducerRecord<>("topic", "hello".getBytes()));
        
        
        KafkaConsumer<byte[], byte[]> kafkaConsumer =
            new KafkaConsumer<>(properties, new ByteArrayDeserializer(), new ByteArrayDeserializer());
        kafkaConsumer.subscribe(Collections.singletonList("topic"));
        ConsumerRecords<byte[], byte[]> consumerRecords = kafkaConsumer.poll(1000);
        
        assertEquals(1, consumerRecords.count());
    }



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)