rreddy-22 commented on code in PR #19429: URL: https://github.com/apache/kafka/pull/19429#discussion_r2049313174
########## clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java: ########## @@ -654,6 +657,46 @@ public void initTransactions() { transactionManager.maybeUpdateTransactionV2Enabled(true); } + /** + * Initialize the transactional state for this producer, similar to {@link #initTransactions()} but + * with additional handling for two-phase commit (2PC). Must be called before any send operations + * that require a {@code transactionalId}. + * <p> + * Unlike the standard {@link #initTransactions()}, when {@code keepPreparedTxn} is set to + * {@code true}, the producer does <em>not</em> automatically abort existing transactions + * in the “prepare” phase. Instead, it enters a recovery mode allowing only finalization + * of those previously prepared transactions. This behavior is crucial for 2PC scenarios, Review Comment: I could add the three methods we allow -> commit, abort, complete -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org