Kafka事务奇怪的enable.idempotence属性


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

image


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM