gpt4 book ai didi

apache-kafka - 带有嵌入式 Kafka 的 Spring Kafka 测试在删除日志时失败

转载 作者:行者123 更新时间:2023-12-04 15:41:43 26 4
gpt4 key购买 nike

我正在使用带有嵌入式 kafka 的 spring kafka 进行 JUnit 测试,它在 Windows 上的每个测试中都会出现错误:

Error deleting C:\Users:LXX691\AppData\Local\Temp\kafka-1103610162480947200/.lock: The process cannot access the file because it is being used by another process.

我只是做了如下的基本配置
@SpringBootTest(webEnvironment = RANDOM_PORT)
@RunWith(SpringRunner.class)
public class KafkaTest {
@Autowired
EmbeddedKafkaBroker broker;

@Before
void setUp() throws Exception() {
// setup producer and consumers
}

@Test
void test() {
producer.send(new ProducerRecord<>("topic", "content"));
}
}

任何解决建议或任何解决方法表示赞赏。

最佳答案

这是 Apache Kafka 中的一个已知问题:https://issues.apache.org/jira/browse/KAFKA-8145 .

不幸的是,我们在 Spring Kafka 中对此无能为力。

在此处查看更多信息:Kafka: unable to start Kafka - process can not access file 00000000000000000000.timeindex和这里 https://github.com/spring-projects/spring-kafka/issues/194

关于apache-kafka - 带有嵌入式 Kafka 的 Spring Kafka 测试在删除日志时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57622587/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com