onyx-kafka
onyx-kafka copied to clipboard
StringSerializer/StringDeserializer instead of ByteArraySerializer/ByteArrayDeserializer
I would really like org.apache.kafka.common.serialization.StringDeserializer
for key.deserializer
and key.serializer
. My data is small <100 byte strings, and being able to kafkacat
a topic and read the results would give me great leverage.
This pull request seems to enable what I want, and it was never merged: https://github.com/onyx-platform/onyx-kafka/pull/55
- Why was it never merged?
- Is this more easily done by just adding
key.deserializer
andkey.serializer
into the consumer-config and constructing (i.e.)key-deserializer
with that, or defaulting to(h/byte-array-deserializer)
if it's not defined?
Hi, yes, we have wanted to add support for Kafka serializers for a while. Not supporting them means you have to stay outside of Kafka land, and this is obviously not ideal.
#55 isn't really a good fit for your needs - it was implemented primarily to support one of our products at the time which was an alternative implementation of a Kafka consumer. I think you'd be better off implementing the ability to supply a serializers via the consumer opts. I think supplying key.deserializer or value.deserializer props via the consumer props would be best. To do so we would need to avoid the 3 arg consumer constructor that passes in the deserialisers via the constructor. I originally thought that you could supply them via kafka/consumer-opts, but the 3 arg constructor will prevent this.
Feel free to add support for this (and a small test) and I would be very happy to accept the PR.
Thanks!