Skip to content
Kafka Is Fun

SpringSpring Kafka Configuration

What is spring.kafka.consumer.isolation-level and when do you need it?

Reference answer

It sets the Kafka consumer isolation.level, which controls how the consumer reads transactional data. With read_committed, poll() returns only transactional messages that have been committed: messages from aborted transactions are filtered out, and the consumer reads only up to the Last Stable Offset, which is the first offset of an open transaction, so records after an open transaction are not returned until it is committed or aborted. Non-transactional messages are returned in either mode. The default is read_uncommitted (read-uncommitted in Spring Boot), which returns all messages, including those from aborted transactions. Commit and abort markers take up offsets but are never returned to the application at either isolation level, so gaps in offsets are normal. You need read_committed when consuming topics written by transactional producers and you must not see uncommitted or aborted data, for example the consuming side of an exactly-once pipeline; it makes no difference for topics written by non-transactional producers.

Expected key concepts: read_committed, aborted transactions, Last Stable Offset, open transaction, read_uncommitted, markers, transactional producers, poll

How did that feel?

Your own verdict, not the score. It shows up next to this question in the list, so you can come back to the shaky ones.