I was wondering why the TransactionalSource is forcing isolation.level to ‘read_committed’:
/** * We set the isolation.level config to read_committed to make sure that any consumed messages are from * committed transactions. Note that the consuming partitions may be produced by multiple producers, and these * producers may either use transactional messaging or not at all. So the fetching partitions may have both * transactional and non-transactional messages, and by setting isolation.level config to read_committed consumers * will still consume non-transactional messages. */ private val txConsumerSettings = consumerSettings.withProperty( ConsumerConfig.ISOLATION_LEVEL_CONFIG, IsolationLevel.READ_COMMITTED.toString.toLowerCase(Locale.ENGLISH) )
I understand why it is safe and a good practice to use transactions in all the steps of a streaming flow,
but I don’t understand why the isolation.level is forcibly set to ‘read_committed’ instead of just as a default value.
Why shouldn’t I be able to use transactions when I’m consuming non-transactional messages?
I have to admit that the comment is unclear, especially the following part
by setting isolation.level config to read_committed consumers will still consume non-transactional messages