Details
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
Attachments
Issue Links
- duplicates
-
KAFKA-6052 Windows: Consumers not polling when isolation.level=read_committed
- Resolved