You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by Jacek Laskowski <ja...@japila.pl> on 2021/09/19 10:33:32 UTC

KafkaProducer.configureTransactionState and overriding enable.idempotence

Hi,

I found KafkaProducer.configureTransactionState [1] quite confusing and
can't really understand what `if (userConfiguredTransactions &&
!userConfiguredIdempotence)` [2] is doing:

        if (userConfiguredTransactions && !userConfiguredIdempotence)
            log.info("Overriding the default {} to true since {} is
specified.", ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG,
                    ProducerConfig.TRANSACTIONAL_ID_CONFIG);

This is the whole if block that claims it does an override but it clearly
does not. Quite puzzling, isn't it?

(I think some other piece of code does the override, i.e. [3], and I'm
curious why this log.info is here not there?)

[1]
https://github.com/apache/kafka/blob/310e240abd6acb6ad27dea8b5aae01c1a7674ca4/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java#L514-L544
[2]
https://github.com/apache/kafka/blob/310e240abd6acb6ad27dea8b5aae01c1a7674ca4/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java#L521-L523
[3]
https://github.com/apache/kafka/blob/310e240abd6acb6ad27dea8b5aae01c1a7674ca4/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java#L525

Pozdrawiam,
Jacek Laskowski
----
https://about.me/JacekLaskowski
"The Internals Of" Online Books <https://books.japila.pl/>
Follow me on https://twitter.com/jaceklaskowski

<https://twitter.com/jaceklaskowski>