Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache kafka 嵌入的Kafkacluster是否丢失?_Apache Kafka_Integration Testing_Apache Kafka Streams - Fatal编程技术网

Apache kafka 嵌入的Kafkacluster是否丢失?

Apache kafka 嵌入的Kafkacluster是否丢失?,apache-kafka,integration-testing,apache-kafka-streams,Apache Kafka,Integration Testing,Apache Kafka Streams,此博客条目引用了EmbeddedKafkaCluster类,该类应该位于库kafka streams test utils中 但是,该库中缺少此类,例如org.apache.kafka/kafka streams test utils/2.5.1 我想我可以使用github的源代码 但是这个源代码引用了一些类,例如kafka.zk.EmbeddedZookeeper和kafka.utils.MockTime,我认为它们必须在org.apache.kafka/kafka_2.13/2.5.1这样的

此博客条目引用了EmbeddedKafkaCluster类,该类应该位于库kafka streams test utils中

但是,该库中缺少此类,例如org.apache.kafka/kafka streams test utils/2.5.1

我想我可以使用github的源代码

但是这个源代码引用了一些类,例如kafka.zk.EmbeddedZookeeper和kafka.utils.MockTime,我认为它们必须在org.apache.kafka/kafka_2.13/2.5.1这样的库中。不幸的是,他们也失踪了

在这种情况下,配置项目以使用EmbeddedKafkCaluster的最佳方法是什么

谢谢


Boris添加以下依赖项:

    //build.gradle

    testCompile group: 'junit', name: 'junit', version: '4.13'
    testCompile group: 'org.hamcrest', name: 'hamcrest-junit', version: '2.0.0.0'

    compile group: 'org.apache.kafka', name: 'kafka_2.13', version: '2.7.0'
    testCompile group: 'org.apache.kafka', name: 'kafka_2.13', version: '2.7.0', classifier:'test'
    compile group: 'org.apache.kafka', name: 'kafka-streams', version: '2.7.0'
    testCompile group: 'org.apache.kafka', name: 'kafka-streams', version: '2.7.0', classifier: 'test'
    compile group: 'org.apache.kafka', name: 'kafka-streams-test-utils', version:  '2.7.0'
    testCompile group: 'org.apache.kafka', name: 'kafka-clients', version: '2.7.0', classifier: 'test'
如果您使用的是Maven,请基于以下代码转换所有依赖项:

//pom.xml
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka-streams</artifactId>
    <version>2.7.0</version>
    <scope>test</scope>
    <classifier>test</classifier>
</dependency>

那个repo不是真正的卡夫卡源代码。还有,你在用Maven吗?如果是这样的话,有一些分类器添加了测试类Indeed,我尝试了测试分类器-但没有帮助我知道有一个JIRA关于使嵌入式服务器更容易集成。弹簧卡夫卡一是广泛使用,否则。或者,你能使用docker吗?我们的部分开发工作在未安装docker(无法安装)的Windows上进行。现在,我们将研究github.com/salesforce/kafka-junit。我们还将使用EmbeddedSingleNodeCluster可用的一些源代码来集成模式注册表
    @Test
    fun createEmbeddedKafkaClusterTest() {

        val NUM_BROKERS = 1
        val embeddedKafkaCluster = EmbeddedKafkaCluster(NUM_BROKERS)
        Assert.assertNotNull(embeddedKafkaCluster)

        embeddedKafkaCluster.start()

        embeddedKafkaCluster.createTopic("TestTopic")
    }