Closed jafri closed 5 years ago
Using String(message.value)
works, but should that be necessary?
Hi @jafri, Kafka can carry any payload so we can't assume that you are publishing strings, for example, you could be using Avro which has a binary payload. Your messages will always receive a Buffer
on key
and value
; you can use value.toString()
to convert it to a string, so using your example:
this.abisConsumer.run({
eachMessage: async ({ /*topic, partition,*/ message }) => {
console.log({
key: message.key,
value: message.value.toString() // <- toString here
})
},
})
Producer:
Consumer:
Result:
I get the correct results using another tool like
kafkacat