Thread
#multiplatform
    d

    dazza5000

    2 years ago
    did you import kafka?
    Patrick Doering

    Patrick Doering

    2 years ago
    How can I import kafka from kafkajs in Kotlin?
    d

    dazza5000

    2 years ago
    idk, but it liooks like that might be the issues
    Patrick Doering

    Patrick Doering

    2 years ago
    I solved the issue with that implementation: 
    
    // declarations
    @JsModule("kafkajs")
    external object kafka {
        fun consumer(options: ConsumerOptions): dynamic
    }
    
    external interface ConsumerOptions {
        var groupID: String
    }
    
    // code
    fun createConsumer(): dynamic {
    val options: ConsumerOptions = js("({})")
    options.groupID = "test-group"
    return kafka.consumer(options)
    }
    Now I get the next error: TypeError: $module$kafkajs.consumer is not a function