79578375

Date: 2025-04-17 02:40:14
Score: 3
Natty:
Report link

I found the answer.

When using Kafka transactions, the acknowledge mode (AckMode) does not actually affect the behavior.

See this discussion for reference:

Spring Kafka Consumer ACKMODE & Producer buffering for Kafka transactions

Even in the TransactionTemplate, it simply executes the code and then commits — there's no coordination with AckMode.

So regardless of whether you set AckMode.BATCH or AckMode.RECORD, the transaction boundary determines the commit, not the acknowledge mode.
https://github.com/spring-projects/spring-framework/blob/39e263fe5d8ba767d22e594cffd02420bab43f2a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionTemplate.java#L127

Reasons:
  • Probably link only (1):
  • No code block (0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: samsamsamsmasma