[ https://issues.apache.org/jira/browse/KAFKA-6744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16434357#comment-16434357 ]
Pascal Gélinas commented on KAFKA-6744: --------------------------------------- Yeah I could, it's been on the back of my mind but I've been busy with trying to understand/implement transactions on our current setup. When I get back to this test, probably next week, I'll be able to provide a quick PR for this. > MockProducer with transaction enabled doesn't fail on commit if a record was > failed > ----------------------------------------------------------------------------------- > > Key: KAFKA-6744 > URL: https://issues.apache.org/jira/browse/KAFKA-6744 > Project: Kafka > Issue Type: Bug > Components: producer > Affects Versions: 1.0.0 > Reporter: Pascal Gélinas > Priority: Minor > > The KafkaProducer#send documentation states the following: > When used as part of a transaction, it is not necessary to define a callback > or check the result of the future in order to detect errors from send. If any > of the send calls failed with an irrecoverable error, the final > commitTransaction() call will fail and throw the exception from the last > failed send. > So I was expecting the following to throw an exception: > {{*MockProducer*<String, byte[]> producer = new MockProducer<>(false,}} > {{ new StringSerializer(), new ByteArraySerializer());}} > {{producer.initTransactions();}} > {{producer.beginTransaction();}} > {{producer.send(new ProducerRecord<>("foo", new byte[]{}));}} > {{producer.errorNext(new RuntimeException());}} > {{producer.commitTransaction(); // Expecting this to throw}} > Unfortunately, the commitTransaction() call returns successfully. -- This message was sent by Atlassian JIRA (v7.6.3#76005)