Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-6153

Kafka Transactional Messaging does not work on windows but on linux

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Duplicate
    • 0.11.0.1
    • None
    • consumer, producer

    Description

      As mentioned in title, the kafka transaction messaging does not work on windows but on linux.

      The code is like below:

      
       stringProducer.initTransactions();
      
              while(true){
                  ConsumerRecords<String, String> records = stringConsumer.poll(2000);
      
                  if(!records.isEmpty()){
                      stringProducer.beginTransaction();
                      try{
                          for(ConsumerRecord record : records){
                              LOGGER.info(record.value().toString());
                              stringProducer.send(new ProducerRecord<String, String>("kafka-test-out", record.value().toString()));
                          }
      
                          stringProducer.commitTransaction();
                      }catch (ProducerFencedException e){
                          LOGGER.warn(e.getMessage());
                          stringProducer.close();
                          stringConsumer.close();
                      }catch (KafkaException e){
                          LOGGER.warn(e.getMessage());
                          stringProducer.abortTransaction();
                      }
                  }
              }
      

      When I debug it, it seems to it stuck on committing the transaction. Does anyone also experience the same thing? Is there any specific configs that i need to add in the producer config? Thanks.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              hardyhan Changhai Han
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: