You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I would like to produce kafka record keys that are not strings (eg ints). I'm using KafkaJS version 2.2.3.
Describe the solution you'd like
A clear and concise description of what you want to happen. Please include links to other clients' solutions and/or KIPs for Kafka features if applicable.
Additional context
Here is a minimally reproducible example:
The first record gets an error while the second is fine.
{"level":"ERROR","timestamp":"2023-03-01T20:26:43.464Z","logger":"kafkajs","message":"[Producer] The \"string\" argument must be of type string or an instance of Buffer or ArrayBuffer. Received type number (5)","retryCount":0,"retryTime":266}
...
key:0
value:Rafael17@hotmail.com
The text was updated successfully, but these errors were encountered:
So the keys in Kafka are always just bytes. The fact that we accept a string is just convenience because there's a default way to encode that string into a buffer (see Buffer.from). But for numbers there are many ways you could choose to serialize them, big endian vs little endian, for example. That's why the input type is string | Buffer | null:
Is your feature request related to a problem? Please describe.
I would like to produce kafka record keys that are not strings (eg ints). I'm using KafkaJS version 2.2.3.
Describe the solution you'd like
A clear and concise description of what you want to happen. Please include links to other clients' solutions and/or KIPs for Kafka features if applicable.
Additional context
Here is a minimally reproducible example:
The first record gets an error while the second is fine.
The text was updated successfully, but these errors were encountered: