Skip to content

Latest commit

 

History

History
64 lines (50 loc) · 1008 Bytes

README.adoc

File metadata and controls

64 lines (50 loc) · 1008 Bytes

Ktor Kafka Feature

Usage

  • add dependency and jitpack repo

    build.gradle
    repositories {
      maven { url 'https://jitpack.io' }
    }
    
    dependencies {
      implementation 'com.github.gAmUssA:ktor-kafka:main-SNAPSHOT'
    }
    build.gradle.kts
    repositories {
        maven {
            url = uri("https://jitpack.io")
        }
    }
    
    dependencies{
        implementation("com.github.gAmUssA:ktor-kafka:main-SNAPSHOT")
    }
  • in Application.module

    Application.kt
    import io.confluent.developer.ktor.Kafka
    import io.confluent.developer.ktor.newTopic
    
    fun Application.module(){
    
        //install Kafka feature
        install(Kafka) {
            configurationPath = "src/main/resources/kafka.conf"
            topics = listOf(
                newTopic("myTopic") {
                    partitions = 3
                    replicas = 1
                }
            )
        }
    }