You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Pascal Gélinas (JIRA)" <ji...@apache.org> on 2018/04/03 18:11:00 UTC
[jira] [Created] (KAFKA-6744) MockProducer with transaction enabled
doesn't fail on commit if a record was failed
Pascal Gélinas created KAFKA-6744:
-------------------------------------
Summary: 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
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)