kafka-jira mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pascal Gélinas (JIRA) <j...@apache.org>
Subject [jira] [Created] (KAFKA-6744) MockProducer with transaction enabled doesn't fail on commit if a record was failed
Date Tue, 03 Apr 2018 18:11:00 GMT
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)

Mime
View raw message