Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

apache kafka - How can I use the full ksqldb client api with gradle?

How can I use the full ksqldb client api with gradle? Why are there 2 different packages?

repositories {
    mavenCentral()
    jcenter()
    maven {
        url "https://packages.confluent.io/maven/"
    }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib"
    compile group: 'io.confluent.ksql', name: 'ksqldb-api-client', version: '6.0.0'
}

I would like to reference v0.11.0. It contains more methods: https://docs.ksqldb.io/en/latest/developer-guide/ksqldb-clients/java-client/api/io/confluent/ksql/api/client/Client.html

https://docs.ksqldb.io/en/0.10.0-ksqldb/developer-guide/ksqldb-clients/java-client/api/io/confluent/ksql/api/client/Client.html

import io.confluent.ksql.api.client.ClientOptions
import io.confluent.ksql.api.client.*

fun main()
{
    val KSQLDB_SERVER_HOST = "localhost"
    val KSQLDB_SERVER_HOST_PORT = 8089
    
    val clientOptions = ClientOptions.create()
        .setHost(KSQLDB_SERVER_HOST)
        .setPort(KSQLDB_SERVER_HOST_PORT)

    val client: Client = io.confluent.ksql.api.client.Client.create(clientOptions)

    val topics = client.listTopics() //not available in 6.0.0
}

Edit: Based on @Hellmar Becker's post I would like to use the standalone (community) version not the commercial Confluent Platform version. It looks like that the CP version uses an older API version anyway.

I found an example how to do this with pom.xml on Github developer guide, but I would like to use a build.gradle file


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There are different numbering schemes for the community licensed KSQLDB (currently v0.12) and the commercial Confluent Platform (currently v6.0.1). Maybe this comparison helps: https://docs.confluent.io/platform/current/ksqldb/index.html#ksqldb-standalone-and-ksqldb-for-cp.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...