Transactional Producer — Concept Check
Questions on Transactional Producer. Transactions span multiple partitions atomically; beginTransaction/commitTransaction ensure consume-transform-produce pipelines are atomic without duplicates or losses.
Questions in this quiz
8 questions on Transactional Producer — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A developer configures a Kafka producer with `transactional.id="order-processor-1"` and enables idempotence. What will happen if the producer crashes during a transaction?
- AThe broker will automatically abort the transaction.
- BThe producer will retry the transaction automatically.
- CThe transaction will be committed automatically.
- DThe consumer will see uncommitted records.
2.A Kafka consumer is set with `isolation.level=read_committed`. What records will it read?
- AOnly records from committed transactions and non-transactional records.
- BRecords from in-flight transactions immediately.
- COnly records from aborted transactions.
- DAll records, including those from aborted transactions.
3.A service using Kafka transactions is experiencing consumer lag. The last stable offset (LSO) is not advancing. What could be the cause?
- AThe producer is not using idempotence.
- BThe consumer is reading too fast.
- CThe broker is misconfigured.
- DAn open transaction is neither committed nor aborted.
4.A developer believes that setting `isolation.level=read_uncommitted` is safe for exactly-once semantics. What is the flaw in this belief?
- AIt prevents reading any records.
- BIt ensures exactly-once semantics.
- CIt allows reading uncommitted records, risking duplicates.
- DIt hides records from aborted transactions.
5.In a Kafka transaction, what happens if `commitTransaction()` is not called after `beginTransaction()`?
- AThe transaction is automatically committed.
- BThe producer retries the transaction.
- CThe transaction remains open and uncommitted.
- DThe transaction is automatically aborted.
6.A developer uses Spring Kafka with `@Transactional`. What happens if an exception occurs in the annotated method?
- AThe transaction is committed regardless.
- BThe offsets are committed but the transaction is not.
- CThe transaction is rolled back and offsets are not committed.
- DThe transaction continues without rollback.
7.What is the role of `initTransactions()` in a Kafka producer?
- ACommits the current transaction.
- BBegins a new transaction scope.
- CAborts any open transactions.
- DRegisters the transactional ID and fences previous producers.
8.A Kafka producer is configured with `transactional.id` but without enabling idempotence. What is the likely outcome?
- AThe broker will reject the configuration.
- BThe producer will not achieve exactly-once semantics.
- CThe producer will automatically enable idempotence.
- DThe producer will achieve exactly-once semantics.