edenhill / kcat

Generic command line non-JVM Apache Kafka producer and consumer
Other
5.45k stars 483 forks source link

Protobuf consumer support #353

Open sbillet opened 3 years ago

sbillet commented 3 years ago

First of all, thank you for providing this immensely useful tool!

Here comes a feature request.

Since April 2020 the Confluent Kafka platform has "first-class citizen" support of Protobuf protocol and schemas in all components (source). Producing/consuming data and the interaction with the Schema Registry works in the same transparent way as for Avro format.

It would be fantastic if kafkacat could provide the same native support for consuming Protobuf messages as for Avro messages.

With that feature, it should be possible to write

kafkacat -C -b localhost:9092 \
-t proto-topic \
-s key=s -s value=proto \
-r http://localhost:8081

and get the topic messages printed nicely because Kafkacat got the schema from the registry and did the deserializing.

This would be much nicer for manual interaction than having to pipe the output to protoc as described in #72

VanceLongwill commented 9 months ago

I've written a small CLI in Rust to do just this with a similar interface to kcat. It's called milena and it supports consuming/decoding and producing/encoding protobuf kafka messages to and from JSON for ease of use

oberbichler commented 9 months ago

protosaurus can automatically deserialize the output of kcat using the corresponding protos from a schema registry:

kcat -C -e -F <kafka.config> -t <topic> -f "%o\\n%k\\n%R%s" | protosaurus - --schema-registry <url>