在 KafkaProperties中配置沒有發現配置參數
- enable.idempotence 也就是說沒有辦法通過直接配置開啟,也就無法使用事物,當然可以選擇手動配置Kafka
@ConfigurationProperties( prefix = "spring.kafka" ) public class KafkaProperties { private List<String> bootstrapServers = new ArrayList(Collections.singletonList("localhost:9092")); private String clientId; private final Map<String, String> properties = new HashMap(); private final KafkaProperties.Consumer consumer = new KafkaProperties.Consumer(); private final KafkaProperties.Producer producer = new KafkaProperties.Producer(); private final KafkaProperties.Admin admin = new KafkaProperties.Admin(); private final KafkaProperties.Streams streams = new KafkaProperties.Streams(); private final KafkaProperties.Listener listener = new KafkaProperties.Listener();
但是 Spring Boot Kafka 聽下面兩個配置會自動開啟冪等性
spring.kafka.consumer.isolation-level=read_committed
spring.kafka.producer.transaction-id-prefix=test