https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
d

dazza5000

08/31/2020, 7:35 PM
did you import kafka?
p

Patrick Doering

08/31/2020, 7:42 PM
How can I import kafka from kafkajs in Kotlin?
d

dazza5000

08/31/2020, 8:18 PM
idk, but it liooks like that might be the issues
p

Patrick Doering

09/01/2020, 7:11 AM
Copy code
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
4 Views