Kafka事务奇怪的enable.idempotence属性
时间:2020-02-23 18:35:02
收藏:0
阅读:560
在 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原文:https://www.cnblogs.com/dgwblog/p/12352991.html
评论(0)
