After upgrading the spring boot to 2.2.5 from 2.1.11 version, the kafka client is producing the messages to the broker before the jpa transaction is committed. Without using the chained kafka transaction manager the transaction was working fine. Is there any backward compatibility changes introducing in transaction between 2.1.x and 2.2.x? Could someone provide any working transactions manager spanning JPA and Kafka?
I was using just the following transaction manager for JPA
@Bean
@Primary
public PlatformTransactionManager transactionManager(final EntityManagerFactory emf) {
final JpaTransactionManager txManager = new JpaTransactionManager();
txManager.setEntityManagerFactory(emf);
return txManager;
}
I was using the following properties for kafka transaction:
spring.cloud.stream.kafka.default.consumer.configuration.isolation.level: read_committed spring.cloud.stream.kafka.binder.transaction.transaction-id-prefix: xyz-0 spring.kafka.producer.transaction-id-prefix: xyz-0